Skip to content

Instantly share code, notes, and snippets.

@chischaschos
Created April 7, 2011 15:21
Show Gist options
  • Save chischaschos/907988 to your computer and use it in GitHub Desktop.
Save chischaschos/907988 to your computer and use it in GitHub Desktop.
Removes loner idle keys
module Resque
module Tools
extend self
def remove_idle_keys
affected = 0
if ::Resque.info[:pending] == 0
keys = ::Resque.redis.keys.grep(/loners/)
affected = keys.reduce(affected) do |r,key|·
r += ::Resque.redis.del(key)
end
end
affected
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment