redis_queued_locks 0.0.32 → 0.0.33

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d33fd5af73686a34765eb95c54fe9dc28b107a01768e41b2a28150dffdc72a60
4
- data.tar.gz: 0ac04f452fbd00b01df535a48dd724e360ed66f42459e33fbf989427531c6b6a
3
+ metadata.gz: 43854a2842911dcf40e95329b2631bc6c76cdaff0cd204fb57eff55c0ee461aa
4
+ data.tar.gz: c361d55a71ac4c71d307fca4a7182069d055e302ec7b65274bcbc1a4ede6f768
5
5
  SHA512:
6
- metadata.gz: 419d36772547c3a7010353d6589b62c442cd7e2575a1c96fcf8ebcee9be83c002a44de7a5dc6de8faa6e32c76f044bf5eaf659ddaf156e8eb3093587dab54e90
7
- data.tar.gz: 28ba2de724d7d7540d967e9ade24ca6d65126af526224ae90f418c04e58618ff1aa856911d9eef363b004272fda73a0ce5ddf83a52460e4d78f09dabdd9fba3f
6
+ metadata.gz: 6887f12891fce49f878427b501980695872e304c1429331d23b251d2f66f2db1f07a0994952f0b4ad6d9ec9b81ea769eaefe09ab1bef0c1abcadc9770ef38344
7
+ data.tar.gz: aa2f6d2cfbe72dd6bf5c637f5538ce1df7c8415579505f765b3016a4c243abc52cd1db246f51abba7efa51abef123d577e26bfee992a5484208cb1416ca00f50
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.0.33] - 2024-03-26
4
+ ### Added
5
+ - Logging: added current lock data info to the detailed `#try_to_lock` log to the cases when lock is still obtained. It is suitable
6
+ when you pass a custom metadata with lock obtainer (for example: the current string of code) and want to see this information
7
+ in logs when you can not acquire the concrete lock long time;
8
+
3
9
  ## [0.0.32] - 2024-03-26
4
10
  ### Added
5
11
  - Support for custom metadata that merged to the lock data. This data also returned from `RedisQueudLocks::Client#lock_info` method;
data/README.md CHANGED
@@ -140,18 +140,27 @@ clinet = RedisQueuedLocks::Client.new(redis_client) do |config|
140
140
  # (default: RedisQueuedLocks::Logging::VoidLogger)
141
141
  # - the logger object;
142
142
  # - should implement `debug(progname = nil, &block)` (minimal requirement) or be an instance of Ruby's `::Logger` class/subclass;
143
- # - at this moment the only debug logs are realised in 3 cases:
144
- # - start of lock obtaining: "[redis_queud_locks.start_lock_obtaining] lock_key => 'rql:lock:your_lock' acq_id => 'rql:acq:54307/3620/3640/3540/c1799ede93'"
145
- # - finish of the lock obtaining: "[redis_queued_locks.lock_obtained] lock_key => 'rql:lock:your_lock' acq_id => 'rql:acq:54307/3620/3640/3540/c1799ede93' acq_time => 123.456 (ms)"
146
- # - start of the lock expiration after `yield`: "[redis_queud_locks.expire_lock] lock_key => 'rql:lock:your_lock' acq_id => 'rql:acq:54307/3620/3640/3540/c1799ede93'"
143
+ # - at this moment the only debug logs are realised in following cases:
144
+ # - "[redis_queued_locks.start_lock_obtaining]" (logs "lock_key", "queue_ttl", "acq_id");
145
+ # - "[redis_queued_locks.start_try_to_lock_cycle]" (logs "lock_key", "queue_ttl", "acq_id");
146
+ # - "[redis_queued_locks.dead_score_reached__reset_acquier_position]" (logs "lock_key", "queue_ttl", "acq_id");
147
+ # - "[redis_queued_locks.lock_obtained]" (logs "lockkey", "queue_ttl", "acq_id", "acq_time");
147
148
  # - by default uses VoidLogger that does nothing;
148
149
  config.logger = RedisQueuedLocks::Logging::VoidLogger
149
150
 
150
151
  # (default: false)
151
- # - should be logged the each internal try-retry lock acquire (a lot of logs can be generated depending on your retry configurations);
152
- # - it adds 2 cases to the log in addition to the existing 3:
153
- # - start of a try: "[redis_queud_locks.try_lock_start] lock_key => 'rql:lock:your_lock' acq_id => 'rql:acq:54307/3620/3640/3540/c1799ede93'"
154
- # - redis connection is feteched from the pool after "start of a try": "[redis_queued_locks.try_lock_rconn_fetched] lock_key => 'rql:lock:your_lock' acq_id => 'rql:acq:54307/3620/3640/3540/c1799ede93'"
152
+ # - adds additional debug logs;
153
+ # - enables additional logs for each internal try-retry lock acquiring (a lot of logs can be generated depending on your retry configurations);
154
+ # - it adds following logs in addition to the existing:
155
+ # - "[redis_queued_locks.try_lock.start]" (logs "lock_key", "queue_ttl", "acq_id");
156
+ # - "[redis_queued_locks.try_lock.rconn_fetched]" (logs "lock_key", "queue_ttl", "acq_id");
157
+ # - "[redis_queued_locks.try_lock.acq_added_to_queue]" (logs "lock_key", "queue_ttl", "acq_id)";
158
+ # - "[redis_queued_locks.try_lock.remove_expired_acqs]" (logs "lock_key", "queue_ttl", "acq_id");
159
+ # - "[redis_queued_locks.try_lock.get_first_from_queue]" (logs "lock_key", "queue_ttl", "acq_id", "first_acq_id_in_queue");
160
+ # - "[redis_queued_locks.try_lock.exit__queue_ttl_reached]" (logs "lock_key", "queue_ttl", "acq_id");
161
+ # - "[redis_queued_locks.try_lock.exit__no_first]" (logs "lock_key", "queue_ttl", "acq_id", "first_acq_id_in_queue", "<current_lock_data>");
162
+ # - "[redis_queued_locks.try_lock.exit__still_obtained]" (logs "lock_key", "queue_ttl", "acq_id", "first_acq_id_in_queue", "locked_by_acq_id", "<current_lock_data>");
163
+ # - "[redis_queued_locks.try_lock.run__free_to_acquire]" (logs "lock_key", "queue_ttl", "acq_id");
155
164
  # - if logger is not configured this option does not lead to any effect;
156
165
  config.log_lock_try = false
157
166
  end
@@ -46,7 +46,7 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
46
46
  "[redis_queued_locks.try_lock.start] " \
47
47
  "lock_key => '#{lock_key}' " \
48
48
  "queue_ttl => #{queue_ttl} " \
49
- "acq_id => '#{acquier_id}' "
49
+ "acq_id => '#{acquier_id}'"
50
50
  )
51
51
  end
52
52
  end
@@ -163,7 +163,8 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
163
163
  "lock_key => '#{lock_key}' " \
164
164
  "queue_ttl => #{queue_ttl} " \
165
165
  "acq_id => '#{acquier_id}' " \
166
- "first_acq_id_in_queue => '#{waiting_acquier}'"
166
+ "first_acq_id_in_queue => '#{waiting_acquier}' " \
167
+ "<current_lock_data> => <<#{rconn.call('HGETALL', lock_key).to_h}>>"
167
168
  )
168
169
  end
169
170
  end
@@ -199,7 +200,8 @@ module RedisQueuedLocks::Acquier::AcquireLock::TryToLock
199
200
  "queue_ttl => #{queue_ttl} " \
200
201
  "acq_id => '#{acquier_id}' " \
201
202
  "first_acq_id_in_queue => '#{waiting_acquier}' " \
202
- "locked_by_acq_id => '#{locked_by_acquier}'"
203
+ "locked_by_acq_id => '#{locked_by_acquier}' " \
204
+ "<current_lock_data> => <<#{rconn.call('HGETALL', lock_key).to_h}>>"
203
205
  )
204
206
  end
205
207
  end
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 0.0.32
9
- VERSION = '0.0.32'
8
+ # @version 0.0.33
9
+ VERSION = '0.0.33'
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_queued_locks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.32
4
+ version: 0.0.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov