Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Call encode once to remove the possibility of different encoded job values. #599

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/resque/scheduler/delaying_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ def enqueue_in_with_queue(queue, number_of_seconds_from_now,
# if O(log(n)). Returns true if it's the first job to be scheduled at
# that time, else false
def delayed_push(timestamp, item)
encoded_job = encode(item)

# First add this item to the list for this timestamp
redis.rpush("delayed:#{timestamp.to_i}", encode(item))
redis.rpush("delayed:#{timestamp.to_i}", encoded_job)

# Store the timestamps at with this item occurs
redis.sadd("timestamps:#{encode(item)}", "delayed:#{timestamp.to_i}")
redis.sadd("timestamps:#{encoded_job}", "delayed:#{timestamp.to_i}")

# Now, add this timestamp to the zsets. The score and the value are
# the same since we'll be querying by timestamp, and we don't have
Expand Down