Commit dc7374af authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'bvl-dont-deduplicate-postponed-jobs' into 'master'

Don't try to deduplicate scheduled jobs

See merge request gitlab-org/gitlab!27976
parents 09236cc9 001b8ddb
...@@ -5,6 +5,9 @@ module Gitlab ...@@ -5,6 +5,9 @@ module Gitlab
module DuplicateJobs module DuplicateJobs
class Client class Client
def call(worker_class, job, queue, _redis_pool, &block) def call(worker_class, job, queue, _redis_pool, &block)
# We don't try to deduplicate jobs that are scheduled in the future
return yield if job['at']
DuplicateJob.new(job, queue).schedule(&block) DuplicateJob.new(job, queue).schedule(&block)
end end
end end
......
...@@ -30,5 +30,15 @@ describe Gitlab::SidekiqMiddleware::DuplicateJobs::Client, :clean_gitlab_redis_q ...@@ -30,5 +30,15 @@ describe Gitlab::SidekiqMiddleware::DuplicateJobs::Client, :clean_gitlab_redis_q
expect(job2['duplicate-of']).to be_nil expect(job2['duplicate-of']).to be_nil
expect(job3['duplicate-of']).to eq(job1['jid']) expect(job3['duplicate-of']).to eq(job1['jid'])
end end
it "does not mark a job that's scheduled in the future as a duplicate" do
TestDeduplicationWorker.perform_async('args1')
TestDeduplicationWorker.perform_at(1.day.from_now, 'args1')
TestDeduplicationWorker.perform_in(3.hours, 'args1')
duplicates = TestDeduplicationWorker.jobs.map { |job| job['duplicate-of'] }
expect(duplicates).to all(be_nil)
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment