Created
April 11, 2011 11:49
-
-
Save kalv/913392 to your computer and use it in GitHub Desktop.
Clear out Resque messages that have Decode errors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use from console, was required as old messages were incorrectly encoded and placed on the failed queue | |
# preventing us to view the failed queue. | |
include Resque::Helpers | |
Resque::Failure.count.times do |index| | |
puts "Checking #{index}" | |
begin | |
decode Resque.redis.lindex(:failed, index) | |
rescue Resque::Helpers::DecodeException | |
puts "deleting #{index} from failed queue" | |
id = rand(0xffffff) | |
Resque.redis.lset(:failed, index, id) | |
puts Resque.redis.lrem(:failed, 1, id) | |
else | |
puts "ignore #{index}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment