Last active
August 29, 2015 14:14
-
-
Save sclinede/8affb4ffa6713e7113f8 to your computer and use it in GitHub Desktop.
Clear BgExecutor queue by job name
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
bgkey = ::BgExecutor::Configuration[:redis][:namespace] + ':bg_executor:jobs_queue' | |
job_name = 'worker:mail' # 'map_coord' | |
# Test: | |
result = [] | |
($redis.llen bgkey).times { |idx| p idx if idx % 100 == 0; val = ($redis.lindex bgkey, idx).to_s; result << val if val.include?(job_name) } | |
# And Run: | |
# result.each { |val| $redis.lrem bgkey, 0, val } | |
# NOT ($redis.llen bgkey).times { |idx| val = ($redis.lindex bgkey, idx); $redis.lrem bgkey, 0, val if val.include?(job_name) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment