taskiq-redis 1.2.1__tar.gz → 1.2.2__tar.gz
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.
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/PKG-INFO +1 -1
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/pyproject.toml +1 -1
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/redis_broker.py +6 -1
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/LICENSE +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/README.md +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/__init__.py +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/exceptions.py +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/list_schedule_source.py +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/py.typed +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/redis_backend.py +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/redis_cluster_broker.py +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/redis_sentinel_broker.py +0 -0
- {taskiq_redis-1.2.1 → taskiq_redis-1.2.2}/taskiq_redis/schedule_source.py +0 -0
|
@@ -161,6 +161,7 @@ class RedisStreamBroker(BaseRedisBroker):
|
|
|
161
161
|
approximate: bool = True,
|
|
162
162
|
idle_timeout: int = 600000, # 10 minutes
|
|
163
163
|
unacknowledged_batch_size: int = 100,
|
|
164
|
+
unacknowledged_lock_timeout: float | None = None,
|
|
164
165
|
xread_count: int | None = 100,
|
|
165
166
|
additional_streams: dict[str, str | int] | None = None,
|
|
166
167
|
**connection_kwargs: Any,
|
|
@@ -188,8 +189,10 @@ class RedisStreamBroker(BaseRedisBroker):
|
|
|
188
189
|
:param xread_count: number of messages to fetch from the stream at once.
|
|
189
190
|
:param additional_streams: additional streams to read from.
|
|
190
191
|
Each key is a stream name, value is a consumer id.
|
|
191
|
-
:param redeliver_timeout: time in ms to wait before redelivering a message.
|
|
192
192
|
:param unacknowledged_batch_size: number of unacknowledged messages to fetch.
|
|
193
|
+
:param unacknowledged_lock_timeout: time in seconds before auto-releasing
|
|
194
|
+
the lock. Useful when the worker crashes or gets killed.
|
|
195
|
+
If not set, the lock can remain locked indefinitely.
|
|
193
196
|
"""
|
|
194
197
|
super().__init__(
|
|
195
198
|
url,
|
|
@@ -209,6 +212,7 @@ class RedisStreamBroker(BaseRedisBroker):
|
|
|
209
212
|
self.additional_streams = additional_streams or {}
|
|
210
213
|
self.idle_timeout = idle_timeout
|
|
211
214
|
self.unacknowledged_batch_size = unacknowledged_batch_size
|
|
215
|
+
self.unacknowledged_lock_timeout = unacknowledged_lock_timeout
|
|
212
216
|
self.count = xread_count
|
|
213
217
|
|
|
214
218
|
async def _declare_consumer_group(self) -> None:
|
|
@@ -290,6 +294,7 @@ class RedisStreamBroker(BaseRedisBroker):
|
|
|
290
294
|
for stream in [self.queue_name, *self.additional_streams.keys()]:
|
|
291
295
|
lock = redis_conn.lock(
|
|
292
296
|
f"autoclaim:{self.consumer_group_name}:{stream}",
|
|
297
|
+
timeout=self.unacknowledged_lock_timeout,
|
|
293
298
|
)
|
|
294
299
|
if await lock.locked():
|
|
295
300
|
continue
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|