job_boss 0.7.11 → 0.7.12
Sign up to get free protection for your applications and to get access to all the features.
- data/job_boss.gemspec +1 -1
- data/lib/job_boss/job.rb +5 -9
- metadata +3 -3
data/job_boss.gemspec
CHANGED
data/lib/job_boss/job.rb
CHANGED
@@ -10,7 +10,6 @@ module JobBoss
|
|
10
10
|
scope :pending, where('started_at IS NULL AND cancelled_at IS NULL')
|
11
11
|
scope :running, where('started_at IS NOT NULL AND completed_at IS NULL')
|
12
12
|
scope :completed, where('completed_at IS NOT NULL')
|
13
|
-
scope :not_cancelled, where('cancelled_at IS NULL')
|
14
13
|
scope :mia, where("completed_at IS NOT NULL AND status = 'mia'")
|
15
14
|
|
16
15
|
def prototype
|
@@ -178,12 +177,11 @@ module JobBoss
|
|
178
177
|
jobs.each(&:cancel)
|
179
178
|
end
|
180
179
|
|
181
|
-
jobs =
|
182
|
-
jobs = self.scoped if jobs.nil?
|
180
|
+
jobs = get_jobs(jobs)
|
183
181
|
|
184
182
|
ids = jobs.collect(&:id)
|
185
183
|
Job.uncached do
|
186
|
-
until Job.
|
184
|
+
until Job.pending.find_all_by_id(ids).count == 0
|
187
185
|
sleep(sleep_interval)
|
188
186
|
|
189
187
|
if block_given?
|
@@ -199,7 +197,7 @@ module JobBoss
|
|
199
197
|
# Returns a hash where the keys are the job method arguments and the values are the
|
200
198
|
# results of the job processing
|
201
199
|
def result_hash(jobs = nil)
|
202
|
-
get_jobs(jobs)
|
200
|
+
jobs = get_jobs(jobs)
|
203
201
|
|
204
202
|
# the #result method automatically reloads the result here if needed but this will
|
205
203
|
# do it in one SQL call
|
@@ -211,16 +209,14 @@ module JobBoss
|
|
211
209
|
end
|
212
210
|
end
|
213
211
|
|
214
|
-
def cancelled?
|
215
|
-
get_jobs(jobs)
|
216
|
-
|
212
|
+
def cancelled?
|
217
213
|
count = self.where('cancelled_at IS NULL').count
|
218
214
|
|
219
215
|
!(count > 0)
|
220
216
|
end
|
221
217
|
|
222
218
|
def cancel(jobs = nil)
|
223
|
-
get_jobs(jobs)
|
219
|
+
jobs = get_jobs(jobs)
|
224
220
|
|
225
221
|
self.all.each(&:cancel)
|
226
222
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job_boss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 12
|
10
|
+
version: 0.7.12
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Underwood
|