Module: Sidekiq::LimitFetch::Global::Selector
Constant Summary collapse
- MUTEX_FOR_UUID =
Mutex.new
Instance Method Summary collapse
Instance Method Details
#acquire(queues, namespace) ⇒ Object
11 12 13 |
# File 'lib/sidekiq/limit_fetch/global/selector.rb', line 11 def acquire(queues, namespace) redis_eval :acquire, [namespace, uuid, queues] end |
#release(queues, namespace) ⇒ Object
15 16 17 |
# File 'lib/sidekiq/limit_fetch/global/selector.rb', line 15 def release(queues, namespace) redis_eval :release, [namespace, uuid, queues] end |
#uuid ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/sidekiq/limit_fetch/global/selector.rb', line 19 def uuid # - if we'll remove "@uuid ||=" from inside of mutex # then @uuid can be overwritten # - if we'll remove "@uuid ||=" from outside of mutex # then each read will lead to mutex @uuid ||= MUTEX_FOR_UUID.synchronize { @uuid || SecureRandom.uuid } end |