job_boss 0.7.16 → 0.7.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/job_boss.gemspec +1 -1
  2. data/lib/job_boss/boss.rb +9 -1
  3. metadata +4 -26
data/job_boss.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "job_boss"
7
- s.version = '0.7.16'
7
+ s.version = '0.7.17'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Brian Underwood"]
10
10
  s.email = ["ml+job_boss@semi-sentient.com"]
data/lib/job_boss/boss.rb CHANGED
@@ -91,7 +91,7 @@ module JobBoss
91
91
  available_employee_count = wait_for_available_employees
92
92
 
93
93
  if jobs.empty?
94
- jobs = dequeue_jobs
94
+ jobs = wait_for_jobs
95
95
  jobs.each {|job| job.update_attributes(:started_at => Time.now) }
96
96
  end
97
97
 
@@ -113,6 +113,14 @@ module JobBoss
113
113
  employee_count
114
114
  end
115
115
 
116
+ def wait_for_jobs
117
+ while (jobs = dequeue_jobs).empty?
118
+ sleep(config.sleep_interval)
119
+ end
120
+
121
+ jobs
122
+ end
123
+
116
124
  # Dequeues next set of jobs based on prioritized round robin algorithm
117
125
  # Priority of a particular queue determines how many jobs get pulled from that queue each time we dequeue
118
126
  # A priority adjustment is also done to give greater priority to sets of jobs which have been running longer
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job_boss
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 7
9
- - 16
10
- version: 0.7.16
4
+ prerelease:
5
+ version: 0.7.17
11
6
  platform: ruby
12
7
  authors:
13
8
  - Brian Underwood
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-18 00:00:00 -04:00
13
+ date: 2011-06-13 00:00:00 -04:00
19
14
  default_executable: job_boss
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,9 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
35
  version: "0"
47
36
  type: :runtime
48
37
  version_requirements: *id002
@@ -54,9 +43,6 @@ dependencies:
54
43
  requirements:
55
44
  - - ">="
56
45
  - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
46
  version: "0"
61
47
  type: :runtime
62
48
  version_requirements: *id003
@@ -172,25 +158,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
158
  requirements:
173
159
  - - ">="
174
160
  - !ruby/object:Gem::Version
175
- hash: 3
176
- segments:
177
- - 0
178
161
  version: "0"
179
162
  required_rubygems_version: !ruby/object:Gem::Requirement
180
163
  none: false
181
164
  requirements:
182
165
  - - ">="
183
166
  - !ruby/object:Gem::Version
184
- hash: 23
185
- segments:
186
- - 1
187
- - 3
188
- - 6
189
167
  version: 1.3.6
190
168
  requirements: []
191
169
 
192
170
  rubyforge_project:
193
- rubygems_version: 1.3.7
171
+ rubygems_version: 1.6.2
194
172
  signing_key:
195
173
  specification_version: 3
196
174
  summary: Asyncronous, parallel job processing