Redis-backed deduplication middleware for Taskiq
Project description
Taskiq Deduplication
Redis-backed deduplication middleware for Taskiq that prevents duplicate tasks from being queued or executed concurrently.
Documentation: https://taskiq-deduplication.d3vyce.fr
Source Code: https://github.com/d3vyce/taskiq-deduplication
Installation
uv add taskiq-deduplication
Quick Start
from taskiq_redis import ListQueueBroker
from taskiq_deduplication import RedisDeduplicationMiddleware, DuplicateTaskError
broker = ListQueueBroker("redis://localhost:6379").with_middlewares(
RedisDeduplicationMiddleware(redis_url="redis://localhost:6379"),
)
@broker.task
async def send_report(user_id: int) -> None:
...
# First dispatch acquires the lock — succeeds.
await send_report.kiq(user_id=42)
# Second dispatch while the first is queued or running — raises.
try:
await send_report.kiq(user_id=42)
except DuplicateTaskError:
pass # already queued or running
Features
- Sender-side deduplication — rejects duplicate tasks at dispatch time via a Redis lock, before they reach the broker.
- Atomic lock release — lock is released on completion or error via a Lua check-and-delete; only the owning task can release its lock.
- Configurable TTL — set a global default or override per task with the
deduplication_ttllabel. - Explicit lock key — pin any task to a fixed Redis key with
deduplication_key, bypassing fingerprint computation entirely. - Partial fingerprint — deduplicate on a subset of kwargs with
deduplication_key_fields, ignoring irrelevant arguments. - Per-task opt-out — disable deduplication for individual tasks with the
deduplicationlabel.
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file taskiq_deduplication-1.0.2.tar.gz.
File metadata
- Download URL: taskiq_deduplication-1.0.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9603a135ab851d7fb0052a68fd19ae20b17e898c3873285bc207719cdd39bb00
|
|
| MD5 |
9496a519f98f20c549764005d6fe2302
|
|
| BLAKE2b-256 |
767cfbbb4b9d94ac492a842d2d584478353b425aa91178013f03cc365bb9ba18
|
Provenance
The following attestation bundles were made for taskiq_deduplication-1.0.2.tar.gz:
Publisher:
build-release.yml on d3vyce/taskiq-deduplication
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
taskiq_deduplication-1.0.2.tar.gz -
Subject digest:
9603a135ab851d7fb0052a68fd19ae20b17e898c3873285bc207719cdd39bb00 - Sigstore transparency entry: 1437764706
- Sigstore integration time:
-
Permalink:
d3vyce/taskiq-deduplication@4fb99e358ebed82b7a819a1732ba045c316847ee -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/d3vyce
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@4fb99e358ebed82b7a819a1732ba045c316847ee -
Trigger Event:
release
-
Statement type:
File details
Details for the file taskiq_deduplication-1.0.2-py3-none-any.whl.
File metadata
- Download URL: taskiq_deduplication-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3984f2f50f708e750e41a309cea02d0a7a14e4e5a0e0473f64ff877eeac5b8ec
|
|
| MD5 |
5c946ea62d561e8cf9d0127f5f30ce95
|
|
| BLAKE2b-256 |
ef2be9fdf7d08fab4ba68591d0c6c8bed9cdddd48bb61b7ded62278251840468
|
Provenance
The following attestation bundles were made for taskiq_deduplication-1.0.2-py3-none-any.whl:
Publisher:
build-release.yml on d3vyce/taskiq-deduplication
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
taskiq_deduplication-1.0.2-py3-none-any.whl -
Subject digest:
3984f2f50f708e750e41a309cea02d0a7a14e4e5a0e0473f64ff877eeac5b8ec - Sigstore transparency entry: 1437764728
- Sigstore integration time:
-
Permalink:
d3vyce/taskiq-deduplication@4fb99e358ebed82b7a819a1732ba045c316847ee -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/d3vyce
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-release.yml@4fb99e358ebed82b7a819a1732ba045c316847ee -
Trigger Event:
release
-
Statement type: