diff options
author | Mike Perham <mperham@gmail.com> | 2014-05-20 09:45:37 -0700 |
---|---|---|
committer | Mike Perham <mperham@gmail.com> | 2014-05-20 09:45:37 -0700 |
commit | b48050d0ef4c17038457e1abc7a14dbde997b587 (patch) | |
tree | c4ac8dda24fbe7953f85eef80e3a02fa0e70203d | |
parent | 0e60e8878378f29f63e8d7e5ee0455e011ac3840 (diff) | |
download | rails-b48050d0ef4c17038457e1abc7a14dbde997b587.tar.gz rails-b48050d0ef4c17038457e1abc7a14dbde997b587.tar.bz2 rails-b48050d0ef4c17038457e1abc7a14dbde997b587.zip |
cleanup
-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 |