FIX: don't allow concurrently queued once off jobs to do work

This commit is contained in:
Sam 2016-04-12 23:08:10 +10:00
parent 72849e65de
commit eda6084d4b

View file

@ -12,6 +12,7 @@ class Jobs::Onceoff < Jobs::Base
if args[:force] || !OnceoffLog.where(job_name: job_name).exists?
return if $redis.exists(self.class.name)
DistributedMutex.synchronize(self.class.name) do
return if OnceoffLog.where(job_name: job_name).exists? && !args[:force]
execute_onceoff(args)
OnceoffLog.create(job_name: job_name)
end