Last active
August 11, 2020 22:43
-
-
Save flaviokr/0bd413a26ade1b9119974d7d66b4422d to your computer and use it in GitHub Desktop.
This file contains 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
# para mover da fila low para pending | |
q_from = "low" | |
q_to = "pending" | |
count_block = proc{ Sidekiq.redis { |conn| conn.llen("queue:#{q_from}") } } | |
while count_block.call > 0 do | |
Sidekiq.redis { |conn| conn.rpoplpush "queue:#{q_from}", "queue:#{q_to}" } | |
end | |
# para recuperar os jobs da fila pending | |
# verificar se todos os jobs são da mesma classe | |
Redis.new.lrange('playax:queue:pending', 0, -1).each do |job| | |
job = JSON.parse(job) | |
<Worker>.perform_async(job['args'].first) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment