Skip to content

Instantly share code, notes, and snippets.

@amerine
Forked from kalv/gist:913392
Created October 5, 2011 18:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amerine/1265199 to your computer and use it in GitHub Desktop.
Save amerine/1265199 to your computer and use it in GitHub Desktop.
Clear out Resque messages that have Decode errors.
# 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