resque-batched-job 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -53,6 +53,13 @@ module Resque
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
# After a job is removed, also remove it from the batch.
|
57
|
+
#
|
58
|
+
# @param id (see Resque::Plugins::BatchedJob#after_enqueue_batch)
|
59
|
+
def after_dequeue_batch(id, *args)
|
60
|
+
remove_batched_job(id, *args)
|
61
|
+
end
|
62
|
+
|
56
63
|
# Checks the size of the batched job list and returns true if the list is
|
57
64
|
# empty or if the key does not exist.
|
58
65
|
#
|
data/test/test_batched_job.rb
CHANGED
@@ -44,7 +44,7 @@ class BatchedJobTest < Test::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# Make sure the after_batch hook is fired
|
47
|
-
def
|
47
|
+
def test_batch_hooks
|
48
48
|
assert_equal(false, Job.batch_exist?(@batch_id))
|
49
49
|
|
50
50
|
assert_nothing_raised do
|
@@ -158,6 +158,24 @@ class BatchedJobTest < Test::Unit::TestCase
|
|
158
158
|
assert(Job.batch_exist?(@batch_id))
|
159
159
|
end
|
160
160
|
|
161
|
+
def test_dequeue
|
162
|
+
assert_nothing_raised do
|
163
|
+
2.times do
|
164
|
+
Resque.enqueue(JobWithoutArgs, @batch_id)
|
165
|
+
Resque.enqueue(Job, @batch_id, "foo")
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
Resque.dequeue(JobWithoutArgs, @batch_id)
|
170
|
+
assert_equal(3, redis.llen(@batch))
|
171
|
+
Resque.dequeue(Job, @batch_id, "foo")
|
172
|
+
assert_equal(2, redis.llen(@batch))
|
173
|
+
Resque.dequeue(JobWithoutArgs, @batch_id)
|
174
|
+
Resque.dequeue(Job, @batch_id, "foo")
|
175
|
+
assert(Job.batch_complete?(@batch_id))
|
176
|
+
assert_equal(false, Job.batch_exist?(@batch_id))
|
177
|
+
end
|
178
|
+
|
161
179
|
private
|
162
180
|
|
163
181
|
def redis
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-batched-job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: resque
|
16
|
-
requirement: &
|
16
|
+
requirement: &70272544091880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: 1.10.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70272544091880
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: turn
|
27
|
+
requirement: &70272544091120 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70272544091120
|
25
36
|
description: ! " Resque plugin for batching jobs. When a batch/group of jobs are
|
26
37
|
complete, \nadditional work can be performed usings batch hooks.\n"
|
27
38
|
email: dan@dj-agiledev.com
|