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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: taskiq-redis
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Redis integration for taskiq
5
5
  Keywords: async,distributed,redis,result_backend,taskiq,tasks
6
6
  Author: Taskiq team
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "taskiq-redis"
3
- version = "1.2.1"
3
+ version = "1.2.2"
4
4
  description = "Redis integration for taskiq"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -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