I am trying to convert a Resque queue to Sidekiq. I've completed the entire setup for Sidekiq, and now am ready to add all my resque jobs to sidekiq ones.
My question is: Can I simply rename all the resque keys in redis to the corresponding sidekiq keys?
For instance, if I have a queue named "twitter", the redis key for resque is "resque:queue:twitter", but the key in sidekiq would be "queue:twitter". Could I simply rename "resque:queue:twitter" to "queue:twitter" ?
Out-of-the-box Sidekiq uses a single queue named "default," but it's possible to create and use any number of other named queues if there is at least one Sidekiq worker configured to look at every queue.
Sidekiq uses Redis as a job management store to process thousands of jobs per second.
Ok Finally Got it
There are few global command that I missed and rename
is perhaps one of them.
Where you can rename the keys If you want
do something like this
redis.rename "resque:queue:twitter","queue:twitter"
And see if it work
Cheers
Thanks for the question It just brushed up by redis knowledge
Here is some code I used to migrate over our existing resque jobs to sidekiq. You can use this in the rails console.
['low', 'high', 'critical'].each do |queue|
p [1, queue]
old_queue = "resque:queue:#{queue}"
new_queue = "queue:#{queue}"
# $redis.ltrim new_queue, 0, 0 # can optionally clear out new queue, in case of multiple runs
vals = $redis.lrange(old_queue, 0, -1)
p [2, queue]
$redis.pipelined do
vals.each do |val|
$redis.lpush(new_queue, val)
end
end
end
You can also just set:
Sidekiq.configure_server do |config|
config.redis = { :namespace => 'resque' }
end
Sidekiq.configure_client do |config|
config.redis = { :namespace => 'resque' }
end
and it will work out of the box. But after I deployed without this, I had pending jobs in both formats, so had to use the first code I pasted to migrate things over.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With