Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
594b131d17 | ||
|
|
61b144328d
|
||
|
|
ef0048577d
|
||
|
|
a1bce5bb33
|
||
|
|
9a43ed9ae0
|
||
|
|
f252d3bdd3
|
||
|
|
38127874b5
|
@@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: linux_amd
|
runs-on: linux_amd
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v7
|
||||||
# with:
|
# with:
|
||||||
# lfs: 'true'
|
# lfs: 'true'
|
||||||
- name: Checkout LFS
|
- name: Checkout LFS
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
# Build Stage
|
# Build Stage
|
||||||
FROM hugomods/hugo:0.155.3 AS build
|
FROM hugomods/hugo:0.161.1 AS build
|
||||||
|
|
||||||
ARG BLOWFISH_VERSION
|
ARG BLOWFISH_VERSION
|
||||||
|
|
||||||
@@ -7,11 +7,11 @@ WORKDIR /opt/blog
|
|||||||
COPY . /opt/blog/
|
COPY . /opt/blog/
|
||||||
|
|
||||||
RUN git submodule update --init --recursive && \
|
RUN git submodule update --init --recursive && \
|
||||||
git -C themes/blowfish/ checkout v2.98.0
|
git -C themes/blowfish/ checkout v2.103.0
|
||||||
RUN hugo
|
RUN hugo
|
||||||
|
|
||||||
# Publish Stage
|
# Publish Stage
|
||||||
FROM nginx:1.30-alpine
|
FROM nginx:1.31-alpine
|
||||||
|
|
||||||
WORKDIR /usr/share/nginx/html
|
WORKDIR /usr/share/nginx/html
|
||||||
COPY --from=build /opt/blog/public /usr/share/nginx/html/
|
COPY --from=build /opt/blog/public /usr/share/nginx/html/
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,7 @@ tags: ["python", "fastapi", "package", "toolsets"]
|
|||||||

|

|
||||||
{{< github repo="d3vyce/fastapi-toolsets" >}}
|
{{< github repo="d3vyce/fastapi-toolsets" >}}
|
||||||
|
|
||||||
> Production-ready utilities for FastAPI applications
|
> Production-ready utilities for FastAPI applications
|
||||||
|
|
||||||
A modular collection of production-ready utilities for FastAPI. Install only what you need — from async CRUD and database helpers to CLI tooling, Prometheus metrics, and pytest fixtures. Each module is independently installable via optional extras, keeping your dependency footprint minimal.
|
A modular collection of production-ready utilities for FastAPI. Install only what you need — from async CRUD and database helpers to CLI tooling, Prometheus metrics, and pytest fixtures. Each module is independently installable via optional extras, keeping your dependency footprint minimal.
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ A modular collection of production-ready utilities for FastAPI. Install only wha
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The base package includes the core modules (CRUD, database, schemas, exceptions, fixtures, dependencies, logging):
|
The base package includes the core modules (CRUD, database, schemas, exceptions, fixtures, dependencies, model mixins, logging):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv add fastapi-toolsets
|
uv add fastapi-toolsets
|
||||||
@@ -44,9 +44,9 @@ uv add fastapi-toolsets
|
|||||||
Install only the extras you need:
|
Install only the extras you need:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uv add "fastapi-toolsets[cli]" # CLI (typer)
|
uv add "fastapi-toolsets[cli]"
|
||||||
uv add "fastapi-toolsets[metrics]" # Prometheus metrics (prometheus_client)
|
uv add "fastapi-toolsets[metrics]"
|
||||||
uv add "fastapi-toolsets[pytest]" # Pytest helpers (httpx, pytest-xdist)
|
uv add "fastapi-toolsets[pytest]"
|
||||||
```
|
```
|
||||||
|
|
||||||
Or install everything:
|
Or install everything:
|
||||||
@@ -63,7 +63,9 @@ uv add "fastapi-toolsets[all]"
|
|||||||
- **Database**: Session management, transaction helpers, table locking, and polling-based row change detection
|
- **Database**: Session management, transaction helpers, table locking, and polling-based row change detection
|
||||||
- **Dependencies**: FastAPI dependency factories (`PathDependency`, `BodyDependency`) for automatic DB lookups from path or body parameters
|
- **Dependencies**: FastAPI dependency factories (`PathDependency`, `BodyDependency`) for automatic DB lookups from path or body parameters
|
||||||
- **Fixtures**: Fixture system with dependency management, context support, and pytest integration
|
- **Fixtures**: Fixture system with dependency management, context support, and pytest integration
|
||||||
- **Standardized API Responses**: Consistent response format with `Response`, `PaginatedResponse`, and `PydanticBase`
|
- **Model Mixins**: SQLAlchemy mixins for common column patterns (`UUIDMixin`, `UUIDv7Mixin`, `CreatedAtMixin`, `UpdatedAtMixin`, `TimestampMixin`)
|
||||||
|
- **Lifecycle Events**: Post-commit event system (`EventSession`, `listens_for`) that dispatches async/sync callbacks for insert, update, and delete operations
|
||||||
|
- **Standardized API Responses**: Consistent response format with `Response`, `ErrorResponse`, `PaginatedResponse`, `CursorPaginatedResponse` and `OffsetPaginatedResponse`.
|
||||||
- **Exception Handling**: Structured error responses with automatic OpenAPI documentation
|
- **Exception Handling**: Structured error responses with automatic OpenAPI documentation
|
||||||
- **Logging**: Logging configuration with uvicorn integration via `configure_logging` and `get_logger`
|
- **Logging**: Logging configuration with uvicorn integration via `configure_logging` and `get_logger`
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,80 @@
|
|||||||
|
---
|
||||||
|
title: "Taskiq Deduplication"
|
||||||
|
date: 2026-05-02
|
||||||
|
slug: "taskiq-deduplication"
|
||||||
|
showAuthor: false
|
||||||
|
showWordCount: false
|
||||||
|
showReadingTime: false
|
||||||
|
showRelatedContent: false
|
||||||
|
showPagination: false
|
||||||
|
tags: ["python", "taskiq", "package"]
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
{{< github repo="d3vyce/taskiq-deduplication" >}}
|
||||||
|
|
||||||
|
> Redis-backed deduplication middleware for Taskiq that prevents duplicate tasks from being queued or executed concurrently
|
||||||
|
|
||||||
|
|
||||||
|
[](https://github.com/d3vyce/taskiq-deduplication/actions/workflows/ci.yml)
|
||||||
|
[](https://codecov.io/gh/d3vyce/taskiq-deduplication)
|
||||||
|
[](https://github.com/astral-sh/ty)
|
||||||
|
[](https://github.com/astral-sh/uv)
|
||||||
|
[](https://github.com/astral-sh/ruff)
|
||||||
|
[](https://www.python.org/downloads/)
|
||||||
|
[](https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Documentation**: [https://taskiq-deduplication.d3vyce.fr](https://taskiq-deduplication.d3vyce.fr)
|
||||||
|
|
||||||
|
**Source Code**: [https://github.com/d3vyce/taskiq-deduplication](https://github.com/d3vyce/taskiq-deduplication)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
uv add taskiq-deduplication
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
```python
|
||||||
|
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 queue lock, before they reach the broker.
|
||||||
|
- **Worker-side detection** — logs concurrent duplicate executions without raising, keeping `SmartRetryMiddleware` safe from retry storms.
|
||||||
|
- **Configurable TTL** — set a global default or override per task with the `deduplication_ttl` label.
|
||||||
|
- **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 `deduplication` label.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT License - see [LICENSE](LICENSE) for details.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! Please feel free to submit issues and pull requests.
|
||||||
Reference in New Issue
Block a user