redis_queued_locks 1.12.1 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.rubocop.yml +3 -1
 - data/.ruby-version +1 -1
 - data/CHANGELOG.md +45 -5
 - data/LICENSE.txt +1 -1
 - data/README.md +574 -296
 - data/Rakefile +12 -4
 - data/Steepfile +15 -0
 - data/github_ci/ruby3.3.gemfile +17 -0
 - data/github_ci/ruby3.3.gemfile.lock +217 -0
 - data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/delay_execution.rb +4 -4
 - data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +40 -0
 - data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/dequeue_from_lock_queue.rb +17 -8
 - data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +166 -0
 - data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +218 -0
 - data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +543 -0
 - data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/try_to_lock.rb +126 -92
 - data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/with_acq_timeout.rb +14 -9
 - data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire/log_visitor.rb +76 -0
 - data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock/yield_expire.rb +42 -19
 - data/lib/redis_queued_locks/{acquier → acquirer}/acquire_lock.rb +74 -47
 - data/lib/redis_queued_locks/{acquier → acquirer}/clear_dead_requests.rb +5 -3
 - data/lib/redis_queued_locks/{acquier → acquirer}/extend_lock_ttl.rb +4 -3
 - data/lib/redis_queued_locks/{acquier → acquirer}/is_locked.rb +1 -1
 - data/lib/redis_queued_locks/{acquier → acquirer}/is_queued.rb +1 -1
 - data/lib/redis_queued_locks/{acquier → acquirer}/keys.rb +5 -5
 - data/lib/redis_queued_locks/{acquier → acquirer}/lock_info.rb +9 -5
 - data/lib/redis_queued_locks/{acquier → acquirer}/locks.rb +16 -3
 - data/lib/redis_queued_locks/{acquier → acquirer}/queue_info.rb +8 -6
 - data/lib/redis_queued_locks/{acquier → acquirer}/queues.rb +9 -2
 - data/lib/redis_queued_locks/{acquier → acquirer}/release_all_locks.rb +26 -21
 - data/lib/redis_queued_locks/{acquier → acquirer}/release_lock.rb +28 -22
 - data/lib/redis_queued_locks/acquirer/release_locks_of.rb +211 -0
 - data/lib/redis_queued_locks/acquirer.rb +19 -0
 - data/lib/redis_queued_locks/client.rb +317 -254
 - data/lib/redis_queued_locks/config/dsl.rb +94 -0
 - data/lib/redis_queued_locks/config.rb +236 -0
 - data/lib/redis_queued_locks/data.rb +2 -0
 - data/lib/redis_queued_locks/errors.rb +27 -11
 - data/lib/redis_queued_locks/instrument.rb +11 -4
 - data/lib/redis_queued_locks/logging/void_logger.rb +38 -1
 - data/lib/redis_queued_locks/logging.rb +20 -5
 - data/lib/redis_queued_locks/resource.rb +49 -11
 - data/lib/redis_queued_locks/swarm/acquirers.rb +17 -16
 - data/lib/redis_queued_locks/swarm/flush_zombies.rb +26 -25
 - data/lib/redis_queued_locks/swarm/probe_hosts.rb +20 -19
 - data/lib/redis_queued_locks/swarm/redis_client_builder.rb +3 -3
 - data/lib/redis_queued_locks/swarm/supervisor.rb +19 -6
 - data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +20 -18
 - data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +35 -27
 - data/lib/redis_queued_locks/swarm/zombie_info.rb +9 -9
 - data/lib/redis_queued_locks/swarm.rb +20 -41
 - data/lib/redis_queued_locks/utilities.rb +11 -2
 - data/lib/redis_queued_locks/version.rb +2 -2
 - data/lib/redis_queued_locks.rb +2 -3
 - data/rbs_collection.lock.yaml +28 -0
 - data/rbs_collection.yaml +17 -0
 - data/redis_queued_locks.gemspec +22 -23
 - data/sig/manifest.yml +6 -0
 - data/sig/redis_queued_locks/acquier.rbs +4 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/delay_execution.rbs +9 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +21 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +26 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +71 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +72 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +179 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +48 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/with_acq_timeout.rbs +19 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +41 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock/yield_with_expire/log_visitor.rbs +32 -0
 - data/sig/redis_queued_locks/acquirer/acquire_lock.rbs +52 -0
 - data/sig/redis_queued_locks/acquirer/clear_dead_requests.rbs +28 -0
 - data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +28 -0
 - data/sig/redis_queued_locks/acquirer/is_locked.rbs +9 -0
 - data/sig/redis_queued_locks/acquirer/is_queued.rbs +9 -0
 - data/sig/redis_queued_locks/acquirer/keys.rbs +10 -0
 - data/sig/redis_queued_locks/acquirer/lock_info.rbs +10 -0
 - data/sig/redis_queued_locks/acquirer/locks.rbs +16 -0
 - data/sig/redis_queued_locks/acquirer/queue_info.rbs +13 -0
 - data/sig/redis_queued_locks/acquirer/queues.rbs +16 -0
 - data/sig/redis_queued_locks/acquirer/release_all_locks.rbs +30 -0
 - data/sig/redis_queued_locks/acquirer/release_lock.rbs +38 -0
 - data/sig/redis_queued_locks/acquirer/release_locks_of.rbs +46 -0
 - data/sig/redis_queued_locks/client.rbs +235 -0
 - data/sig/redis_queued_locks/config/dsl.rbs +26 -0
 - data/sig/redis_queued_locks/config.rbs +23 -0
 - data/sig/redis_queued_locks/data.rbs +4 -0
 - data/sig/redis_queued_locks/debugger/interface.rbs +9 -0
 - data/sig/redis_queued_locks/debugger.rbs +13 -0
 - data/sig/redis_queued_locks/errors.rbs +43 -0
 - data/sig/redis_queued_locks/instrument/active_support.rbs +7 -0
 - data/sig/redis_queued_locks/instrument/sampler.rbs +9 -0
 - data/sig/redis_queued_locks/instrument/void_notifier.rbs +7 -0
 - data/sig/redis_queued_locks/instrument.rbs +15 -0
 - data/sig/redis_queued_locks/logging/sampler.rbs +9 -0
 - data/sig/redis_queued_locks/logging/void_logger.rbs +15 -0
 - data/sig/redis_queued_locks/logging.rbs +15 -0
 - data/sig/redis_queued_locks/resource.rbs +42 -0
 - data/sig/redis_queued_locks/swarm/acquirers.rbs +10 -0
 - data/sig/redis_queued_locks/swarm/flush_zombies.rbs +13 -0
 - data/sig/redis_queued_locks/swarm/probe_hosts.rbs +13 -0
 - data/sig/redis_queued_locks/swarm/redis_client_builder.rbs +19 -0
 - data/sig/redis_queued_locks/swarm/supervisor.rbs +26 -0
 - data/sig/redis_queued_locks/swarm/swarm_element/isolated.rbs +52 -0
 - data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +61 -0
 - data/sig/redis_queued_locks/swarm/swarm_element.rbs +8 -0
 - data/sig/redis_queued_locks/swarm/zombie_info.rbs +24 -0
 - data/sig/redis_queued_locks/swarm.rbs +41 -0
 - data/sig/redis_queued_locks/utilities/lock.rbs +10 -0
 - data/sig/redis_queued_locks/utilities.rbs +12 -0
 - data/sig/redis_queued_locks/version.rbs +3 -0
 - data/sig/redis_queued_locks.rbs +14 -0
 - data/sig/vendor/active_support.rbs +9 -0
 - data/sig/vendor/redis_client.rbs +39 -0
 - data/sig/vendor/semantic_logger.rbs +4 -0
 - metadata +98 -54
 - data/lib/redis_queued_locks/acquier/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +0 -40
 - data/lib/redis_queued_locks/acquier/acquire_lock/instr_visitor.rb +0 -166
 - data/lib/redis_queued_locks/acquier/acquire_lock/log_visitor.rb +0 -216
 - data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock/log_visitor.rb +0 -541
 - data/lib/redis_queued_locks/acquier/acquire_lock/yield_expire/log_visitor.rb +0 -76
 - data/lib/redis_queued_locks/acquier.rb +0 -18
 
| 
         @@ -1,541 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # @api private
         
     | 
| 
       4 
     | 
    
         
            -
            # @since 1.7.0
         
     | 
| 
       5 
     | 
    
         
            -
            # rubocop:disable Metrics/ModuleLength
         
     | 
| 
       6 
     | 
    
         
            -
            module RedisQueuedLocks::Acquier::AcquireLock::TryToLock::LogVisitor
         
     | 
| 
       7 
     | 
    
         
            -
              extend self
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       10 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       11 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       12 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       13 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       14 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       15 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       16 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       17 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       18 
     | 
    
         
            -
              #
         
     | 
| 
       19 
     | 
    
         
            -
              # @api private
         
     | 
| 
       20 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       21 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       22 
     | 
    
         
            -
              def start(
         
     | 
| 
       23 
     | 
    
         
            -
                logger,
         
     | 
| 
       24 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       25 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       26 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       27 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       28 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       29 
     | 
    
         
            -
                host_id,
         
     | 
| 
       30 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       31 
     | 
    
         
            -
              )
         
     | 
| 
       32 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       35 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.start] " \
         
     | 
| 
       36 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       37 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       38 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       39 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       40 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       41 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       45 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       46 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       47 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       48 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       49 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       50 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       51 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       52 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       53 
     | 
    
         
            -
              #
         
     | 
| 
       54 
     | 
    
         
            -
              # @api private
         
     | 
| 
       55 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       56 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       57 
     | 
    
         
            -
              def rconn_fetched(
         
     | 
| 
       58 
     | 
    
         
            -
                logger,
         
     | 
| 
       59 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       60 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       61 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       62 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       63 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       64 
     | 
    
         
            -
                host_id,
         
     | 
| 
       65 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       66 
     | 
    
         
            -
              )
         
     | 
| 
       67 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       70 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.rconn_fetched] " \
         
     | 
| 
       71 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       72 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       73 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       74 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       75 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       76 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       77 
     | 
    
         
            -
              end
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       80 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       81 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       82 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       83 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       84 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       85 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       86 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       87 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       88 
     | 
    
         
            -
              #
         
     | 
| 
       89 
     | 
    
         
            -
              # @api private
         
     | 
| 
       90 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       91 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       92 
     | 
    
         
            -
              def same_process_conflict_detected(
         
     | 
| 
       93 
     | 
    
         
            -
                logger,
         
     | 
| 
       94 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       95 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       96 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       97 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       98 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       99 
     | 
    
         
            -
                host_id,
         
     | 
| 
       100 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       101 
     | 
    
         
            -
              )
         
     | 
| 
       102 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       105 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.same_process_conflict_detected] " \
         
     | 
| 
       106 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       107 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       108 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       109 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       110 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       111 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       112 
     | 
    
         
            -
              end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       115 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       116 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       117 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       118 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       119 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       120 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       121 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       122 
     | 
    
         
            -
              # @param sp_conflict_status [Symbol]
         
     | 
| 
       123 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       124 
     | 
    
         
            -
              #
         
     | 
| 
       125 
     | 
    
         
            -
              # @api private
         
     | 
| 
       126 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       127 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       128 
     | 
    
         
            -
              def same_process_conflict_analyzed(
         
     | 
| 
       129 
     | 
    
         
            -
                logger,
         
     | 
| 
       130 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       131 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       132 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       133 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       134 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       135 
     | 
    
         
            -
                host_id,
         
     | 
| 
       136 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       137 
     | 
    
         
            -
                sp_conflict_status
         
     | 
| 
       138 
     | 
    
         
            -
              )
         
     | 
| 
       139 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       142 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.same_process_conflict_analyzed] " \
         
     | 
| 
       143 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       144 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       145 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       146 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       147 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       148 
     | 
    
         
            -
                  "spc_status => '#{sp_conflict_status}'"
         
     | 
| 
       149 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       150 
     | 
    
         
            -
              end
         
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       153 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       154 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       155 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       156 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       157 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       158 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       159 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       160 
     | 
    
         
            -
              # @param sp_conflict_status [Symbol]
         
     | 
| 
       161 
     | 
    
         
            -
              # @param ttl [Integer]
         
     | 
| 
       162 
     | 
    
         
            -
              # @param spc_processed_timestamp [Float]
         
     | 
| 
       163 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       164 
     | 
    
         
            -
              #
         
     | 
| 
       165 
     | 
    
         
            -
              # @api private
         
     | 
| 
       166 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       167 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       168 
     | 
    
         
            -
              def reentrant_lock__extend_and_work_through(
         
     | 
| 
       169 
     | 
    
         
            -
                logger,
         
     | 
| 
       170 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       171 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       172 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       173 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       174 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       175 
     | 
    
         
            -
                host_id,
         
     | 
| 
       176 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       177 
     | 
    
         
            -
                sp_conflict_status,
         
     | 
| 
       178 
     | 
    
         
            -
                ttl,
         
     | 
| 
       179 
     | 
    
         
            -
                spc_processed_timestamp
         
     | 
| 
       180 
     | 
    
         
            -
              )
         
     | 
| 
       181 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       184 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.reentrant_lock__extend_and_work_through] " \
         
     | 
| 
       185 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       186 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       187 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       188 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       189 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       190 
     | 
    
         
            -
                  "spc_status => '#{sp_conflict_status}' " \
         
     | 
| 
       191 
     | 
    
         
            -
                  "last_ext_ttl => #{ttl} " \
         
     | 
| 
       192 
     | 
    
         
            -
                  "last_ext_ts => '#{spc_processed_timestamp}'"
         
     | 
| 
       193 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       194 
     | 
    
         
            -
              end
         
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       197 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       198 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       199 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       200 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       201 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       202 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       203 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       204 
     | 
    
         
            -
              # @param sp_conflict_status [Symbol]
         
     | 
| 
       205 
     | 
    
         
            -
              # @param spc_processed_timestamp [Float]
         
     | 
| 
       206 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       207 
     | 
    
         
            -
              #
         
     | 
| 
       208 
     | 
    
         
            -
              # @api private
         
     | 
| 
       209 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       210 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       211 
     | 
    
         
            -
              def reentrant_lock__work_through(
         
     | 
| 
       212 
     | 
    
         
            -
                logger,
         
     | 
| 
       213 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       214 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       215 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       216 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       217 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       218 
     | 
    
         
            -
                host_id,
         
     | 
| 
       219 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       220 
     | 
    
         
            -
                sp_conflict_status,
         
     | 
| 
       221 
     | 
    
         
            -
                spc_processed_timestamp
         
     | 
| 
       222 
     | 
    
         
            -
              )
         
     | 
| 
       223 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       226 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.reentrant_lock__work_through] " \
         
     | 
| 
       227 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       228 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       229 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       230 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       231 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       232 
     | 
    
         
            -
                  "spc_status => '#{sp_conflict_status}' " \
         
     | 
| 
       233 
     | 
    
         
            -
                  "last_spc_ts => '#{spc_processed_timestamp}'"
         
     | 
| 
       234 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       235 
     | 
    
         
            -
              end
         
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
       237 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       238 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       239 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       240 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       241 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       242 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       243 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       244 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       245 
     | 
    
         
            -
              # @param sp_conflict_status [Symbol]
         
     | 
| 
       246 
     | 
    
         
            -
              # @param spc_processed_timestamp [Float]
         
     | 
| 
       247 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       248 
     | 
    
         
            -
              #
         
     | 
| 
       249 
     | 
    
         
            -
              # @api private
         
     | 
| 
       250 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       251 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       252 
     | 
    
         
            -
              def single_process_lock_conflict__dead_lock(
         
     | 
| 
       253 
     | 
    
         
            -
                logger,
         
     | 
| 
       254 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       255 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       256 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       257 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       258 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       259 
     | 
    
         
            -
                host_id,
         
     | 
| 
       260 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       261 
     | 
    
         
            -
                sp_conflict_status,
         
     | 
| 
       262 
     | 
    
         
            -
                spc_processed_timestamp
         
     | 
| 
       263 
     | 
    
         
            -
              )
         
     | 
| 
       264 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
       266 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       267 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.single_process_lock_conflict__dead_lock] " \
         
     | 
| 
       268 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       269 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       270 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       271 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       272 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       273 
     | 
    
         
            -
                  "spc_status => '#{sp_conflict_status}' " \
         
     | 
| 
       274 
     | 
    
         
            -
                  "last_spc_ts => '#{spc_processed_timestamp}'"
         
     | 
| 
       275 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       276 
     | 
    
         
            -
              end
         
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       279 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       280 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       281 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       282 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       283 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       284 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       285 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       286 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       287 
     | 
    
         
            -
              #
         
     | 
| 
       288 
     | 
    
         
            -
              # @api private
         
     | 
| 
       289 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       290 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       291 
     | 
    
         
            -
              def acq_added_to_queue(
         
     | 
| 
       292 
     | 
    
         
            -
                logger,
         
     | 
| 
       293 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       294 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       295 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       296 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       297 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       298 
     | 
    
         
            -
                host_id,
         
     | 
| 
       299 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       300 
     | 
    
         
            -
              )
         
     | 
| 
       301 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       304 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.acq_added_to_queue] " \
         
     | 
| 
       305 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       306 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       307 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       308 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       309 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       310 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       311 
     | 
    
         
            -
              end
         
     | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
       313 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       314 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       315 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       316 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       317 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       318 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       319 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       320 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       321 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       322 
     | 
    
         
            -
              #
         
     | 
| 
       323 
     | 
    
         
            -
              # @api private
         
     | 
| 
       324 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       325 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       326 
     | 
    
         
            -
              def remove_expired_acqs(
         
     | 
| 
       327 
     | 
    
         
            -
                logger,
         
     | 
| 
       328 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       329 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       330 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       331 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       332 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       333 
     | 
    
         
            -
                host_id,
         
     | 
| 
       334 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       335 
     | 
    
         
            -
              )
         
     | 
| 
       336 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
       338 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       339 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.remove_expired_acqs] " \
         
     | 
| 
       340 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       341 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       342 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       343 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       344 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       345 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       346 
     | 
    
         
            -
              end
         
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
       348 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       349 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       350 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       351 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       352 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       353 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       354 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       355 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       356 
     | 
    
         
            -
              # @param waiting_acquier [String]
         
     | 
| 
       357 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       358 
     | 
    
         
            -
              #
         
     | 
| 
       359 
     | 
    
         
            -
              # @api private
         
     | 
| 
       360 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       361 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       362 
     | 
    
         
            -
              def get_first_from_queue(
         
     | 
| 
       363 
     | 
    
         
            -
                logger,
         
     | 
| 
       364 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       365 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       366 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       367 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       368 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       369 
     | 
    
         
            -
                host_id,
         
     | 
| 
       370 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       371 
     | 
    
         
            -
                waiting_acquier
         
     | 
| 
       372 
     | 
    
         
            -
              )
         
     | 
| 
       373 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       374 
     | 
    
         
            -
             
     | 
| 
       375 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       376 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.get_first_from_queue] " \
         
     | 
| 
       377 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       378 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       379 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       380 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       381 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       382 
     | 
    
         
            -
                  "first_acq_id_in_queue => '#{waiting_acquier}'"
         
     | 
| 
       383 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       384 
     | 
    
         
            -
              end
         
     | 
| 
       385 
     | 
    
         
            -
             
     | 
| 
       386 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       387 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       388 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       389 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       390 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       391 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       392 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       393 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       394 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       395 
     | 
    
         
            -
              #
         
     | 
| 
       396 
     | 
    
         
            -
              # @api private
         
     | 
| 
       397 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       398 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       399 
     | 
    
         
            -
              def exit__queue_ttl_reached(
         
     | 
| 
       400 
     | 
    
         
            -
                logger,
         
     | 
| 
       401 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       402 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       403 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       404 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       405 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       406 
     | 
    
         
            -
                host_id,
         
     | 
| 
       407 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       408 
     | 
    
         
            -
              )
         
     | 
| 
       409 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       410 
     | 
    
         
            -
             
     | 
| 
       411 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       412 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.exit__queue_ttl_reached] " \
         
     | 
| 
       413 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       414 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       415 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       416 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       417 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       418 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       419 
     | 
    
         
            -
              end
         
     | 
| 
       420 
     | 
    
         
            -
             
     | 
| 
       421 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       422 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       423 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       424 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       425 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       426 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       427 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       428 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       429 
     | 
    
         
            -
              # @param waiting_acquier [String]
         
     | 
| 
       430 
     | 
    
         
            -
              # @param current_lock_data [Hash<String,Any>]
         
     | 
| 
       431 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       432 
     | 
    
         
            -
              #
         
     | 
| 
       433 
     | 
    
         
            -
              # @api private
         
     | 
| 
       434 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       435 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       436 
     | 
    
         
            -
              def exit__no_first(
         
     | 
| 
       437 
     | 
    
         
            -
                logger,
         
     | 
| 
       438 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       439 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       440 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       441 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       442 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       443 
     | 
    
         
            -
                host_id,
         
     | 
| 
       444 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       445 
     | 
    
         
            -
                waiting_acquier,
         
     | 
| 
       446 
     | 
    
         
            -
                current_lock_data
         
     | 
| 
       447 
     | 
    
         
            -
              )
         
     | 
| 
       448 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       449 
     | 
    
         
            -
             
     | 
| 
       450 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       451 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.exit__no_first] " \
         
     | 
| 
       452 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       453 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       454 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       455 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       456 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       457 
     | 
    
         
            -
                  "first_acq_id_in_queue => '#{waiting_acquier}' " \
         
     | 
| 
       458 
     | 
    
         
            -
                  "<current_lock_data> => <<#{current_lock_data}>>"
         
     | 
| 
       459 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       460 
     | 
    
         
            -
              end
         
     | 
| 
       461 
     | 
    
         
            -
             
     | 
| 
       462 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       463 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       464 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       465 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       466 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       467 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       468 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       469 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       470 
     | 
    
         
            -
              # @param waiting_acquier [String]
         
     | 
| 
       471 
     | 
    
         
            -
              # @param locked_by_acquier [String]
         
     | 
| 
       472 
     | 
    
         
            -
              # @param current_lock_data [Hash<String,Any>]
         
     | 
| 
       473 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       474 
     | 
    
         
            -
              #
         
     | 
| 
       475 
     | 
    
         
            -
              # @api private
         
     | 
| 
       476 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       477 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       478 
     | 
    
         
            -
              def exit__lock_still_obtained(
         
     | 
| 
       479 
     | 
    
         
            -
                logger,
         
     | 
| 
       480 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       481 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       482 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       483 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       484 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       485 
     | 
    
         
            -
                host_id,
         
     | 
| 
       486 
     | 
    
         
            -
                access_strategy,
         
     | 
| 
       487 
     | 
    
         
            -
                waiting_acquier,
         
     | 
| 
       488 
     | 
    
         
            -
                locked_by_acquier,
         
     | 
| 
       489 
     | 
    
         
            -
                current_lock_data
         
     | 
| 
       490 
     | 
    
         
            -
              )
         
     | 
| 
       491 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       492 
     | 
    
         
            -
             
     | 
| 
       493 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       494 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.exit__lock_still_obtained] " \
         
     | 
| 
       495 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       496 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       497 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       498 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       499 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}' " \
         
     | 
| 
       500 
     | 
    
         
            -
                  "first_acq_id_in_queue => '#{waiting_acquier}' " \
         
     | 
| 
       501 
     | 
    
         
            -
                  "locked_by_acq_id => '#{locked_by_acquier}' " \
         
     | 
| 
       502 
     | 
    
         
            -
                  "<current_lock_data> => <<#{current_lock_data}>>"
         
     | 
| 
       503 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       504 
     | 
    
         
            -
              end
         
     | 
| 
       505 
     | 
    
         
            -
             
     | 
| 
       506 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       507 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       508 
     | 
    
         
            -
              # @param log_lock_try [Boolean]
         
     | 
| 
       509 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       510 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       511 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       512 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       513 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       514 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       515 
     | 
    
         
            -
              #
         
     | 
| 
       516 
     | 
    
         
            -
              # @api private
         
     | 
| 
       517 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       518 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       519 
     | 
    
         
            -
              def obtain__free_to_acquire(
         
     | 
| 
       520 
     | 
    
         
            -
                logger,
         
     | 
| 
       521 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       522 
     | 
    
         
            -
                log_lock_try,
         
     | 
| 
       523 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       524 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       525 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       526 
     | 
    
         
            -
                host_id,
         
     | 
| 
       527 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       528 
     | 
    
         
            -
              )
         
     | 
| 
       529 
     | 
    
         
            -
                return unless log_sampled && log_lock_try
         
     | 
| 
       530 
     | 
    
         
            -
             
     | 
| 
       531 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       532 
     | 
    
         
            -
                  "[redis_queued_locks.try_lock.obtain__free_to_acquire] " \
         
     | 
| 
       533 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       534 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       535 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       536 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       537 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       538 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       539 
     | 
    
         
            -
              end
         
     | 
| 
       540 
     | 
    
         
            -
            end
         
     | 
| 
       541 
     | 
    
         
            -
            # rubocop:enable Metrics/ModuleLength
         
     | 
| 
         @@ -1,76 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # @api private
         
     | 
| 
       4 
     | 
    
         
            -
            # @since 1.7.0
         
     | 
| 
       5 
     | 
    
         
            -
            module RedisQueuedLocks::Acquier::AcquireLock::YieldExpire::LogVisitor
         
     | 
| 
       6 
     | 
    
         
            -
              extend self
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       9 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       10 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       11 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       12 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       13 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       14 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       15 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       16 
     | 
    
         
            -
              #
         
     | 
| 
       17 
     | 
    
         
            -
              # @api private
         
     | 
| 
       18 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       19 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       20 
     | 
    
         
            -
              def expire_lock(
         
     | 
| 
       21 
     | 
    
         
            -
                logger,
         
     | 
| 
       22 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       23 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       24 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       25 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       26 
     | 
    
         
            -
                host_id,
         
     | 
| 
       27 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       28 
     | 
    
         
            -
              )
         
     | 
| 
       29 
     | 
    
         
            -
                return unless log_sampled
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       32 
     | 
    
         
            -
                  "[redis_queued_locks.expire_lock] " \
         
     | 
| 
       33 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       34 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       35 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       36 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       37 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       38 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       39 
     | 
    
         
            -
              end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
              # @param logger [::Logger,#debug]
         
     | 
| 
       42 
     | 
    
         
            -
              # @param log_sampled [Boolean]
         
     | 
| 
       43 
     | 
    
         
            -
              # @param lock_key [String]
         
     | 
| 
       44 
     | 
    
         
            -
              # @param decreased_ttl [Integer]
         
     | 
| 
       45 
     | 
    
         
            -
              # @param queue_ttl [Integer]
         
     | 
| 
       46 
     | 
    
         
            -
              # @param acquier_id [String]
         
     | 
| 
       47 
     | 
    
         
            -
              # @param host_id [String]
         
     | 
| 
       48 
     | 
    
         
            -
              # @param access_strategy [Symbol]
         
     | 
| 
       49 
     | 
    
         
            -
              # @return [void]
         
     | 
| 
       50 
     | 
    
         
            -
              #
         
     | 
| 
       51 
     | 
    
         
            -
              # @api private
         
     | 
| 
       52 
     | 
    
         
            -
              # @since 1.7.0
         
     | 
| 
       53 
     | 
    
         
            -
              # @version 1.9.0
         
     | 
| 
       54 
     | 
    
         
            -
              def decrease_lock(
         
     | 
| 
       55 
     | 
    
         
            -
                logger,
         
     | 
| 
       56 
     | 
    
         
            -
                log_sampled,
         
     | 
| 
       57 
     | 
    
         
            -
                lock_key,
         
     | 
| 
       58 
     | 
    
         
            -
                decreased_ttl,
         
     | 
| 
       59 
     | 
    
         
            -
                queue_ttl,
         
     | 
| 
       60 
     | 
    
         
            -
                acquier_id,
         
     | 
| 
       61 
     | 
    
         
            -
                host_id,
         
     | 
| 
       62 
     | 
    
         
            -
                access_strategy
         
     | 
| 
       63 
     | 
    
         
            -
              )
         
     | 
| 
       64 
     | 
    
         
            -
                return unless log_sampled
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                logger.debug do
         
     | 
| 
       67 
     | 
    
         
            -
                  "[redis_queued_locks.decrease_lock] " \
         
     | 
| 
       68 
     | 
    
         
            -
                  "lock_key => '#{lock_key}' " \
         
     | 
| 
       69 
     | 
    
         
            -
                  "decreased_ttl => #{decreased_ttl} " \
         
     | 
| 
       70 
     | 
    
         
            -
                  "queue_ttl => #{queue_ttl} " \
         
     | 
| 
       71 
     | 
    
         
            -
                  "acq_id => '#{acquier_id}' " \
         
     | 
| 
       72 
     | 
    
         
            -
                  "hst_id => '#{host_id}' " \
         
     | 
| 
       73 
     | 
    
         
            -
                  "acs_strat => '#{access_strategy}'"
         
     | 
| 
       74 
     | 
    
         
            -
                end rescue nil
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
       76 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,18 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # @api private
         
     | 
| 
       4 
     | 
    
         
            -
            # @since 1.0.0
         
     | 
| 
       5 
     | 
    
         
            -
            module RedisQueuedLocks::Acquier
         
     | 
| 
       6 
     | 
    
         
            -
              require_relative 'acquier/acquire_lock'
         
     | 
| 
       7 
     | 
    
         
            -
              require_relative 'acquier/release_lock'
         
     | 
| 
       8 
     | 
    
         
            -
              require_relative 'acquier/release_all_locks'
         
     | 
| 
       9 
     | 
    
         
            -
              require_relative 'acquier/is_locked'
         
     | 
| 
       10 
     | 
    
         
            -
              require_relative 'acquier/is_queued'
         
     | 
| 
       11 
     | 
    
         
            -
              require_relative 'acquier/lock_info'
         
     | 
| 
       12 
     | 
    
         
            -
              require_relative 'acquier/queue_info'
         
     | 
| 
       13 
     | 
    
         
            -
              require_relative 'acquier/locks'
         
     | 
| 
       14 
     | 
    
         
            -
              require_relative 'acquier/queues'
         
     | 
| 
       15 
     | 
    
         
            -
              require_relative 'acquier/keys'
         
     | 
| 
       16 
     | 
    
         
            -
              require_relative 'acquier/extend_lock_ttl'
         
     | 
| 
       17 
     | 
    
         
            -
              require_relative 'acquier/clear_dead_requests'
         
     | 
| 
       18 
     | 
    
         
            -
            end
         
     |