lib/sidekiq/debounce.rb in sidekiq-debounce-1.0.1 vs lib/sidekiq/debounce.rb in sidekiq-debounce-1.0.2
- old
+ new
@@ -23,11 +23,12 @@
end
end
private
- def store_expiry(conn, jid, time)
+ def store_expiry(conn, job, time)
+ jid = job.respond_to?(:has_key?) && job.key?('jid') ? job['jid'] : job
conn.set(debounce_key, jid)
conn.expireat(debounce_key, time.to_i)
end
def debounce_key
@@ -39,10 +40,10 @@
@scheduled_set ||= Sidekiq::ScheduledSet.new
end
def reschedule(jid, at)
job = scheduled_set.find_job(jid)
- job.reschedule(at)
+ job.reschedule(at) unless job.nil?
jid
end
def debounce?
(@msg['at'] && @worker.get_sidekiq_options['debounce']) || false