diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_job/queue_adapters/sucker_punch_adapter.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/active_job/queue_adapters/sucker_punch_adapter.rb b/lib/active_job/queue_adapters/sucker_punch_adapter.rb index 79043b06e0..7bddf5ce8a 100644 --- a/lib/active_job/queue_adapters/sucker_punch_adapter.rb +++ b/lib/active_job/queue_adapters/sucker_punch_adapter.rb @@ -9,12 +9,7 @@ module ActiveJob end def queue_at(job, timestamp, *args) - delay = Time.now.to_f - timestamp - if delay > 0 - JobWrapper.new.async.later(delay, job, *args) - else - JobWrapper.new.async.perform(job, *args) - end + JobWrapper.new.async.later(timestamp, job, *args) end end @@ -26,7 +21,8 @@ module ActiveJob end def later(sec, job_name, *args) - after(sec) { perform(job_name, *args) } + delay = Time.now.to_f - sec + after(delay > 0 ? delay : 0) { perform(job_name, *args) } end end end |