What's Changed
- Drop Python 3.10 support: Minimum version is now 3.11.
- Remove deprecated DI helpers:
TaskDepends()andWorkerDepends()are gone. Usemy_task.context/my_middleware.context/worker.contextinstead. - Remove deprecated
health_crontabparameter fromWorker, doesn't do anything since health check was refactored. - Async serializer/deserializer support: the
serializeranddeserializerparameters toWorkernow accept both sync and async callables. This can be used to send expensive calls to threads (make sure threading is actually beneficial; see #145). TaskStatusnow inherits fromStrEnum(wasstr, Enum).- Bump
coredisto>=6.7.0; addpytest-randomlyto test suite to randomize test order. - Dropped the SAQ benchmark; refreshed benchmark numbers for v7.0.0.
- Consolidates duplicate enqueuing logic from a couple different places
- Performance improvements to the worker hot path:
- Split cron scheduling, delayed-task publishing, and abort handling out of the producer hot loop into a dedicated
schedule_delayed_tasksbackground task. The producer now only fetches stream entries and fills the queue. - Stream entries are sent directly to the queue instead of being collected into an intermediate list.
- Burst termination now checked in both the producer and consumer so workers wrap up promptly once the stream drains. This allows the
XREADGROUPwithBLOCKto block for much longer periods of time. run_taskpipeline optimized and no longer usesgather. Per-taskfnclosure replaced with a cachedrunnerproperty on registered tasks, so sync tasks getasyncifyapplied once instead of on every run.- Cached
_async_serializer/_async_deserializerflags at init rather than callinginspect.isawaitableper serializer call. - Chained tasks now publish through one
_recursepass over a single transaction pipeline, which fixes a race condition when using dependencies. - Test coverage for burst shutdown after execution, no grace period shutdown under load, and querying queued tasks by status.
- Split cron scheduling, delayed-task publishing, and abort handling out of the producer hot loop into a dedicated
Full Changelog: v6.5.2...v7.0.0