Created
April 7, 2011 15:21
-
-
Save chischaschos/907988 to your computer and use it in GitHub Desktop.
Removes loner idle keys
This file contains hidden or 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
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