Skip to content

Instantly share code, notes, and snippets.

@unixcharles
Created August 23, 2012 14:21
Show Gist options
  • Save unixcharles/3437099 to your computer and use it in GitHub Desktop.
Save unixcharles/3437099 to your computer and use it in GitHub Desktop.
Clean up redis queue
queue_name = 'queue:queue_name'
len = Resque.redis.llen(queue_name)
deletion = Resque.redis.lrange(queue_name,0, len).select do |entry|
JSON.parse(entry)['args'][0] == "some_criterial" rescue nil
end
deletion.each do |entry|
puts entry
puts Resque.redis.lrem queue_name, -1, entry
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment