Update config at redis with locks

I got few service instances, each of which at start should update config at Redis with its queue name or create config at redis if it doesn’t exist:

When the first service instance starts it should create a config with 1 item:

my_service_queues: [ 'queue_1' ]

when the second and third service start they should update the config to that:

my_service_queues: [ 'queue_1', 'queue_2', 'queue_3' ]

I guess each service should lock my_service_queues key on update. How can I do that?

It would be perfect if you provide a code which uses redis gem interface.

Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.