Skip to content

Instantly share code, notes, and snippets.

@romeuhcf
Created June 26, 2019 01:09
Show Gist options
  • Save romeuhcf/0c8f780bcb22275a056057bea99d4153 to your computer and use it in GitHub Desktop.
Save romeuhcf/0c8f780bcb22275a056057bea99d4153 to your computer and use it in GitHub Desktop.
Safely remove every empty sidekiq queue.
redis-cli EVAL 'local n = 0 ; local qs = redis.call("smembers","queues"); for _,q in ipairs(qs) do local qname = "queue:"..q ;if redis.call("llen", qname) == 0 then redis.call("srem", "queues", q) ; redis.call("del", qname); n = n+1 end end ; return n' 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment