redis_queued_locks 1.11.0 → 1.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7161dbfaa5660709705978e003201b12c4684d5c271fc700710802b10586e00
4
- data.tar.gz: efaf7103b6bddfd708aceca2d967f282e60b6a74b43c7de2314512cdc963fd19
3
+ metadata.gz: 9e8dd94852534ed373615917be290e53b29e203e7b88907d24631869ab4f2deb
4
+ data.tar.gz: 9b78929772d22f8ae6cbb628d306a85c44d4eec2f6a41e68bccfa0d754db80b5
5
5
  SHA512:
6
- metadata.gz: 4736b2cf3ec4fa9a121425769a5037aa78d2f5765829533fd4cb830f3e184b856d03a5fc2e7653df3a49c47975de074120f55ddc88476d78b623131ffc718f48
7
- data.tar.gz: eb2e86d9764606a11f7c547e8e1ff6b126a26a3cbfd3ea6cff0f670625d6845a441eb7ef6ad9c0e9ce125e0f5fb983feb068205b04bb5a27b85307d5119140d9
6
+ metadata.gz: 14e6e0c7ff71c9bc0d8a4ff1088a0b9983a8bd365fa10b17236996b3cb20e291fb951e648c79430b2d4091179024385648a343b36913443a9459c3c9e2a71b18
7
+ data.tar.gz: f0aa55c8561513a87d3c8f347db2f9a0710c62b4fe6d03fd6b512fec56c2631da77b86080bbbdf051bfc82d6abe2016f8baf37e43b3eebc973bd404bb7f80a35
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
- ### [1.11.0] - 2024-08-11
3
+ ## [1.12.0] - 2024-08-11
4
+ ### Changed
5
+ - Timed blocks of code and their timeout errors: reduced error message object allocations;
6
+
7
+ ## [1.11.0] - 2024-08-11
4
8
  ### Changed
5
9
  - Lock Acquierment Timeout (`acq_timeout`/`queue_ttl`): more correct timeout error interception
6
10
  inside the `RedisQueuedLocks::Acquier::AcquireLock::WithAcqTimeout` logic that now raises and
@@ -19,6 +19,8 @@ module RedisQueuedLocks::Acquier::AcquireLock::WithAcqTimeout
19
19
  # Callback invoked on Timeout::Error.
20
20
  # @return [Any]
21
21
  #
22
+ # @raise [RedisQueuedLocks::LockAcquiermentIntermediateTimeoutError]
23
+ #
22
24
  # @api private
23
25
  # @since 1.0.0
24
26
  # @version 1.11.0
@@ -107,28 +107,22 @@ module RedisQueuedLocks::Acquier::AcquireLock::YieldExpire
107
107
  # @param block [Blcok]
108
108
  # @return [Any]
109
109
  #
110
+ # @raise [RedisQueuedLocks::TimedLockTimeoutError]
111
+ #
110
112
  # @api private
111
113
  # @since 1.3.0
112
- # @version 1.10.0
114
+ # @version 1.12.0
113
115
  def yield_with_timeout(timeout, lock_key, lock_ttl, acquier_id, host_id, meta, &block)
114
- ::Timeout.timeout(
115
- timeout,
116
+ ::Timeout.timeout(timeout, RedisQueuedLocks::TimedLockIntermediateTimeoutError, &block)
117
+ rescue RedisQueuedLocks::TimedLockIntermediateTimeoutError
118
+ raise(
116
119
  RedisQueuedLocks::TimedLockTimeoutError,
117
- # NOTE:
118
- # - this string is generated on each invocation cuz we need to raise custom exception
119
- # from the Timeout API in order to prevent incorred Timeout::Error interception when
120
- # the intercepted error is caused from the block not from the RQL;
121
- # - we can't omit this string object creation at the moment via original Ruby's Timeout API;
122
- # TODO:
123
- # - refine Timeout#timeout (via Ruby's Refinement API) in order to provide lazy exception
124
- # message initialization;
125
120
  "Passed <timed> block of code exceeded the lock TTL " \
126
121
  "(lock: \"#{lock_key}\", " \
127
122
  "ttl: #{lock_ttl}, " \
128
123
  "meta: #{meta ? meta.inspect : '<no-meta>'}, " \
129
124
  "acq_id: \"#{acquier_id}\", " \
130
125
  "hst_id: \"#{host_id}\")",
131
- &block
132
126
  )
133
127
  end
134
128
  end
@@ -25,6 +25,10 @@ module RedisQueuedLocks
25
25
  # @since 1.0.0
26
26
  LockAcquiermentRetryLimitError = Class.new(Error)
27
27
 
28
+ # @api private
29
+ # @since 1.12.0
30
+ TimedLockIntermediateTimeoutError = Class.new(::Timeout::Error)
31
+
28
32
  # @api pulic
29
33
  # @since 1.0.0
30
34
  TimedLockTimeoutError = Class.new(Error)
@@ -5,6 +5,6 @@ module RedisQueuedLocks
5
5
  #
6
6
  # @api public
7
7
  # @since 0.0.1
8
- # @version 1.11.0
9
- VERSION = '1.11.0'
8
+ # @version 1.12.0
9
+ VERSION = '1.12.0'
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: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.5.11
138
+ rubygems_version: 3.5.17
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Distributed locks with "prioritized lock acquisition queue" capabilities