lib/resque/scheduler/delaying_extensions.rb in resque-scheduler-4.1.0 vs lib/resque/scheduler/delaying_extensions.rb in resque-scheduler-4.2.0

- old
+ new

@@ -208,10 +208,12 @@ # returns the count of jobs removed. # # O(N) where N is the number of jobs scheduled to fire at the given # timestamp def remove_delayed_job_from_timestamp(timestamp, klass, *args) + return 0 if Resque.inline? + key = "delayed:#{timestamp.to_i}" encoded_job = encode(job_to_hash(klass, args)) redis.srem("timestamps:#{encoded_job}", key) count = redis.lrem(key, 0, encoded_job) @@ -262,9 +264,11 @@ def job_to_hash_with_queue(queue, klass, args) { class: klass.to_s, args: args, queue: queue } end def remove_delayed_job(encoded_job) + return 0 if Resque.inline? + timestamps = redis.smembers("timestamps:#{encoded_job}") replies = redis.pipelined do timestamps.each do |key| redis.lrem(key, 0, encoded_job)