taskiq-redis 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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/list_schedule_source.py +14 -0
- {taskiq_redis-1.2.0.dist-info → taskiq_redis-1.2.1.dist-info}/METADATA +3 -3
- {taskiq_redis-1.2.0.dist-info → taskiq_redis-1.2.1.dist-info}/RECORD +5 -5
- {taskiq_redis-1.2.0.dist-info → taskiq_redis-1.2.1.dist-info}/WHEEL +1 -1
- {taskiq_redis-1.2.0.dist-info → taskiq_redis-1.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -85,6 +85,9 @@ class ListRedisScheduleSource(ScheduleSource):
|
|
|
85
85
|
"""Get the key for a cron-based schedule."""
|
|
86
86
|
return f"{self._prefix}:cron"
|
|
87
87
|
|
|
88
|
+
def _get_interval_key(self) -> str:
|
|
89
|
+
return f"{self._prefix}:interval"
|
|
90
|
+
|
|
88
91
|
def _get_data_key(self, schedule_id: str) -> str:
|
|
89
92
|
"""Get the key for a schedule data."""
|
|
90
93
|
return f"{self._prefix}:data:{schedule_id}"
|
|
@@ -150,6 +153,8 @@ class ListRedisScheduleSource(ScheduleSource):
|
|
|
150
153
|
elif schedule.time is not None:
|
|
151
154
|
time_key = self._get_time_key(schedule.time)
|
|
152
155
|
await redis.lrem(time_key, 0, schedule_id) # type: ignore[misc]
|
|
156
|
+
elif schedule.interval:
|
|
157
|
+
await redis.lrem(self._get_interval_key(), 0, schedule_id) # type: ignore[misc]
|
|
153
158
|
|
|
154
159
|
async def add_schedule(self, schedule: "ScheduledTask") -> None:
|
|
155
160
|
"""Add a schedule to the source."""
|
|
@@ -169,6 +174,11 @@ class ListRedisScheduleSource(ScheduleSource):
|
|
|
169
174
|
self._get_time_key(schedule.time),
|
|
170
175
|
schedule.schedule_id,
|
|
171
176
|
)
|
|
177
|
+
elif schedule.interval:
|
|
178
|
+
await redis.rpush( # type: ignore[misc]
|
|
179
|
+
self._get_interval_key(),
|
|
180
|
+
schedule.schedule_id,
|
|
181
|
+
)
|
|
172
182
|
|
|
173
183
|
async def post_send(self, task: ScheduledTask) -> None:
|
|
174
184
|
"""Delete a task after it's completed."""
|
|
@@ -199,6 +209,10 @@ class ListRedisScheduleSource(ScheduleSource):
|
|
|
199
209
|
logger.debug("Got %d cron schedules", len(crons))
|
|
200
210
|
if crons:
|
|
201
211
|
buffer.extend(crons)
|
|
212
|
+
intervals = await redis.lrange(self._get_interval_key(), 0, -1) # type: ignore[misc]
|
|
213
|
+
logger.debug("Got %d interval schedules", len(intervals))
|
|
214
|
+
if intervals:
|
|
215
|
+
buffer.extend(intervals)
|
|
202
216
|
timed.extend(await redis.lrange(self._get_time_key(current_time), 0, -1)) # type: ignore[misc]
|
|
203
217
|
logger.debug("Got %d timed schedules", len(timed))
|
|
204
218
|
if timed:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taskiq-redis
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Redis integration for taskiq
|
|
5
|
-
Keywords:
|
|
5
|
+
Keywords: async,distributed,redis,result_backend,taskiq,tasks
|
|
6
6
|
Author: Taskiq team
|
|
7
7
|
Author-email: Taskiq team <taskiq@no-reply.com>
|
|
8
8
|
License-Expression: MIT
|
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Requires-Dist: redis>=7.0.0,<
|
|
17
|
+
Requires-Dist: redis>=7.0.0,<8
|
|
18
18
|
Requires-Dist: taskiq>=0.12.0
|
|
19
19
|
Maintainer: Taskiq team
|
|
20
20
|
Maintainer-email: Taskiq team <taskiq@no-reply.com>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
taskiq_redis/__init__.py,sha256=Sl4m9rKxweU1t0m289Qtf0qm4xSSkkFHoOfKq6qaz6g,1192
|
|
2
2
|
taskiq_redis/exceptions.py,sha256=7buBJ7CRVWd5WqVqSjtHO8cVL7QzZg-DOM3nB87t-Sk,738
|
|
3
|
-
taskiq_redis/list_schedule_source.py,sha256=
|
|
3
|
+
taskiq_redis/list_schedule_source.py,sha256=Z7YHKUPpdiEc2yu5eskSL7cVsJ-IZgDagEEm5aj8QUU,10589
|
|
4
4
|
taskiq_redis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
taskiq_redis/redis_backend.py,sha256=0d9prosVA85nbu8xBYfmhVW0szjtVmEbG5k6vUCkvtg,19639
|
|
6
6
|
taskiq_redis/redis_broker.py,sha256=ybOG5UzZV9DK_Gf4iS2kTmnVSJrZuw5lv_NtcHTiwuM,12260
|
|
7
7
|
taskiq_redis/redis_cluster_broker.py,sha256=s3UCePRP8C61ABXJmf_aqGXB2FgKnPIJzDfNb-YvAKE,7271
|
|
8
8
|
taskiq_redis/redis_sentinel_broker.py,sha256=5NjsABhyjBfdeaIKxIoiEuuyfIHMgKC0DzIIF6QfAY8,9541
|
|
9
9
|
taskiq_redis/schedule_source.py,sha256=rVdHmAyFaO35jEoHCR7dZxSgWjvCUT0zGabzB1_Algo,9999
|
|
10
|
-
taskiq_redis-1.2.
|
|
11
|
-
taskiq_redis-1.2.
|
|
12
|
-
taskiq_redis-1.2.
|
|
13
|
-
taskiq_redis-1.2.
|
|
10
|
+
taskiq_redis-1.2.1.dist-info/licenses/LICENSE,sha256=lEHEEE-ZxmuItxYgUMPiFWdRcAITxE8DFMNyAg4eOYE,1075
|
|
11
|
+
taskiq_redis-1.2.1.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
|
|
12
|
+
taskiq_redis-1.2.1.dist-info/METADATA,sha256=suCeWTbBDhdHmYfKdD3w_HGEzE6rjHRkxY7ISIcwis8,7159
|
|
13
|
+
taskiq_redis-1.2.1.dist-info/RECORD,,
|
|
File without changes
|