servolux 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.9.6 / 2011-01-02
2
+
3
+ * Minor Enhancements
4
+ * Threaded objects run immediately (sleep after running)
5
+ * Added a "timed_out?" method in the Prefork::Worker class
6
+
1
7
  == 0.9.5 / 2010-07-15
2
8
 
3
9
  * Minor Enhancements
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ rescue LoadError
5
5
  abort '### please install the "bones" gem ###'
6
6
  end
7
7
 
8
- task :default => 'spec:specdoc'
8
+ task :default => 'spec:run'
9
9
  task 'gem:release' => 'spec:run'
10
10
 
11
11
  Bones {
@@ -19,8 +19,7 @@ Bones {
19
19
 
20
20
  use_gmail
21
21
 
22
- depend_on 'bones-extras', :development => true
22
+ depend_on 'bones-rspec', :development => true
23
23
  depend_on 'bones-git', :development => true
24
24
  depend_on 'logging', :development => true
25
- depend_on 'rspec', :development => true
26
25
  }
@@ -239,7 +239,7 @@ class Servolux::Prefork
239
239
  # call-seq:
240
240
  # errors { |worker| block }
241
241
  #
242
- # Iterates over all the works and yields the worker to the given _block_
242
+ # Iterates over all the workers and yields the worker to the given _block_
243
243
  # only if the worker has an error condition.
244
244
  #
245
245
  def errors
@@ -248,7 +248,7 @@ class Servolux::Prefork
248
248
  end
249
249
 
250
250
 
251
- private
251
+ private
252
252
 
253
253
  # Pause script execution for a random time interval between 0.1 and 0.4
254
254
  # seconds. This method is used to slow down the starting and stopping of
@@ -306,7 +306,7 @@ class Servolux::Prefork
306
306
  @thread.wakeup if @thread.status
307
307
  close_parent
308
308
  signal 'TERM'
309
- @thread.join(0.5) rescue nil
309
+ @thread.join(0.5)
310
310
  @thread = nil
311
311
  self
312
312
  end
@@ -347,8 +347,19 @@ class Servolux::Prefork
347
347
  @piper.alive?
348
348
  end
349
349
 
350
+ # Returns +true+ if communication with the child process timed out.
351
+ # Returns +nil+ if the child process has not been started.
352
+ #
353
+ # Always returns +nil+ when called from the child process.
354
+ #
355
+ # @return [Boolean, nil]
356
+ #
357
+ def timed_out?
358
+ return if @piper.nil? or @piper.child?
359
+ Timeout === @error
360
+ end
350
361
 
351
- private
362
+ private
352
363
 
353
364
  def close_parent
354
365
  @piper.timeout = 0.5
@@ -364,7 +375,8 @@ class Servolux::Prefork
364
375
  @piper.puts START
365
376
  Thread.current[:stop] = false
366
377
  response = parent_loop
367
- # TODO: put a logger here to catch and log all exceptions
378
+ rescue StandardError => err
379
+ @error = err
368
380
  ensure
369
381
  @harvest << @piper.pid
370
382
  close_parent
@@ -219,11 +219,11 @@ module Servolux::Threaded
219
219
  def run( threaded )
220
220
  loop {
221
221
  begin
222
- sleep interval if running?
223
222
  break unless running?
224
223
  threaded.run
225
224
  self.iterations += 1
226
225
  break if finished_iterations?
226
+ sleep interval if running?
227
227
  rescue SystemExit; raise
228
228
  rescue Exception => err
229
229
  if continue_on_error
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.9.5
1
+ 0.9.6
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servolux
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 55
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 9
8
- - 5
9
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tim Pease
@@ -14,44 +15,50 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-15 00:00:00 -06:00
18
+ date: 2011-01-02 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: bones-extras
22
+ name: bones-rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 19
27
30
  segments:
28
31
  - 1
29
- - 2
30
- - 4
31
- version: 1.2.4
32
+ - 1
33
+ - 0
34
+ version: 1.1.0
32
35
  type: :development
33
36
  version_requirements: *id001
34
37
  - !ruby/object:Gem::Dependency
35
38
  name: bones-git
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 27
41
46
  segments:
42
47
  - 1
43
48
  - 2
44
- - 0
45
- version: 1.2.0
49
+ - 2
50
+ version: 1.2.2
46
51
  type: :development
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
54
  name: logging
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 1
55
62
  segments:
56
63
  - 1
57
64
  - 4
@@ -59,34 +66,22 @@ dependencies:
59
66
  version: 1.4.3
60
67
  type: :development
61
68
  version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: rspec
64
- prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- segments:
70
- - 1
71
- - 3
72
- - 0
73
- version: 1.3.0
74
- type: :development
75
- version_requirements: *id004
76
69
  - !ruby/object:Gem::Dependency
77
70
  name: bones
78
71
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
80
74
  requirements:
81
75
  - - ">="
82
76
  - !ruby/object:Gem::Version
77
+ hash: 27
83
78
  segments:
84
79
  - 3
80
+ - 5
85
81
  - 4
86
- - 7
87
- version: 3.4.7
82
+ version: 3.5.4
88
83
  type: :development
89
- version_requirements: *id005
84
+ version_requirements: *id004
90
85
  description: |-
91
86
  Serv-O-Lux is a collection of Ruby classes that are useful for daemon and
92
87
  process management, and for writing your own Ruby services. The code is well
@@ -135,25 +130,29 @@ rdoc_options:
135
130
  require_paths:
136
131
  - lib
137
132
  required_ruby_version: !ruby/object:Gem::Requirement
133
+ none: false
138
134
  requirements:
139
135
  - - ">="
140
136
  - !ruby/object:Gem::Version
137
+ hash: 3
141
138
  segments:
142
139
  - 0
143
140
  version: "0"
144
141
  required_rubygems_version: !ruby/object:Gem::Requirement
142
+ none: false
145
143
  requirements:
146
144
  - - ">="
147
145
  - !ruby/object:Gem::Version
146
+ hash: 3
148
147
  segments:
149
148
  - 0
150
149
  version: "0"
151
150
  requirements: []
152
151
 
153
152
  rubyforge_project: servolux
154
- rubygems_version: 1.3.6
153
+ rubygems_version: 1.3.7
155
154
  signing_key:
156
155
  specification_version: 3
157
- summary: Serv-O-Lux is a collection of Ruby classes that are useful for daemon and process management, and for writing your own Ruby services
156
+ summary: Serv-O-Lux is a collection of Ruby classes that are useful for daemon and process management, and for writing your own Ruby services.
158
157
  test_files: []
159
158