module ResqueSlidingWindow::SchedulerPatches

Public Class Methods

extended(base) click to toggle source
# File lib/resque_sliding_window/resque_extensions.rb, line 5
def self.extended(base)
  class << base
    alias_method :delayed_timestamp_peek_without_rescue, :delayed_timestamp_peek
    alias_method :delayed_timestamp_peek, :delayed_timestamp_peek_with_rescue
  end
end

Public Instance Methods

delayed_timestamp_peek_with_rescue(timestamp, start, count) click to toggle source
# File lib/resque_sliding_window/resque_extensions.rb, line 22
def delayed_timestamp_peek_with_rescue(timestamp, start, count)
  delayed_timestamp_peek_without_rescue timestamp, start, count
rescue Resque::Helpers::DecodeException => e
  []
end
next_item_for_timestamp(timestamp) click to toggle source
# File lib/resque_sliding_window/resque_extensions.rb, line 12
def next_item_for_timestamp(timestamp)
  key = "delayed:#{timestamp.to_i}"

  item = patched_decode redis.lpop(key)

  # If the list is empty, remove it.
  clean_up_timestamp(key, timestamp)
  item
end
patched_decode(payload) click to toggle source
# File lib/resque_sliding_window/resque_extensions.rb, line 28
def patched_decode(payload)
  decode payload
rescue Exception => e
end