check a job can't be enqueued multiple times with the same id
(arq_redis: ArqRedis, worker)
| 166 | |
| 167 | |
| 168 | async def test_mung(arq_redis: ArqRedis, worker): |
| 169 | """ |
| 170 | check a job can't be enqueued multiple times with the same id |
| 171 | """ |
| 172 | counter = Counter() |
| 173 | |
| 174 | async def count(ctx, v): |
| 175 | counter[v] += 1 |
| 176 | |
| 177 | tasks = [] |
| 178 | for i in range(50): |
| 179 | tasks += [ |
| 180 | arq_redis.enqueue_job('count', i, _job_id=f'v-{i}'), |
| 181 | arq_redis.enqueue_job('count', i, _job_id=f'v-{i}'), |
| 182 | ] |
| 183 | shuffle(tasks) |
| 184 | await asyncio.gather(*tasks) |
| 185 | |
| 186 | worker: Worker = worker(functions=[func(count, name='count')]) |
| 187 | await worker.main() |
| 188 | assert counter.most_common(1)[0][1] == 1 # no job go enqueued twice |
| 189 | |
| 190 | |
| 191 | async def test_custom_try(arq_redis: ArqRedis, worker): |
nothing calls this directly
no test coverage detected
searching dependent graphs…