Skip to content

Commit

Permalink
fix(continuous): keep meta_id unchanged between continuous jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
take-five committed Jun 19, 2013
1 parent 9ef9554 commit 9561852
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/resque/integration/continuous.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def after_perform_continue(*args)
if continued?
args = if @continued.any?
if unique?
[meta_id(*args)] + @continued
meta_id = args.first # we should keep meta_id as first argument
[meta_id] + @continued
else
@continued
end
Expand Down
14 changes: 14 additions & 0 deletions spec/resque/integration/continuous_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ def self.execute(x, y)
# clean the queue
Resque.dequeue(ContinuousUniqueJobTest)
end

it 'should enqueue job with the same meta_id' do
ContinuousUniqueJobTest.enqueue(3, 1)

job1 = Resque.reserve(ContinuousUniqueJobTest.queue)
meta1 = job1.payload['args'].first

job1.perform

job2 = Resque.reserve(ContinuousUniqueJobTest.queue)
meta2 = job2.payload['args'].first

meta1.should eq meta2
end
end

context 'when called without arguments' do
Expand Down

0 comments on commit 9561852

Please sign in to comment.