diff options
Diffstat (limited to 'lib/active_job/queue_adapters/sucker_punch_adapter.rb')
-rw-r--r-- | lib/active_job/queue_adapters/sucker_punch_adapter.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/active_job/queue_adapters/sucker_punch_adapter.rb b/lib/active_job/queue_adapters/sucker_punch_adapter.rb index 8125499695..79043b06e0 100644 --- a/lib/active_job/queue_adapters/sucker_punch_adapter.rb +++ b/lib/active_job/queue_adapters/sucker_punch_adapter.rb @@ -9,7 +9,12 @@ module ActiveJob end def queue_at(job, timestamp, *args) - JobWrapper.new.async.later(secs, job, *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 end end |