Releases: tastyware/streaq
Release list
v7.1.0
What's Changed
- Add optional retry-on-timeout handling by @Poyraxx in #171
Adds aretry_timeoutsparameter to the task decorator allowing for retrying tasks on timeout (which was previously difficult due to way timeouts were handled internally). - Fix missing title in cron and workers web UI pages
New Contributors
Full Changelog: v7.0.0...v7.1.0
v7.0.0
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
v6.5.2
v6.5.1
What's Changed
- Fix regression from v6.5.0 where retried tasks appear to still be running
Full Changelog: v6.5.0...v6.5.1
v6.5.0
What's Changed
- feat: add fail-over tasks and indexed task enumeration by @Graeme22 in #166
-
Task.otherwise()for fallback execution when a task fails:await my_task.enqueue(4).then(other_task).otherwise(backup_task)
Here, if
other_taskfails,backup_taskwill run with the same arguments. Read more here. -
Replace SCAN-based
_get_running_tasks/_get_completed_taskswith a set for running tasks and an expiry-scored sorted set for finished tasks. Fixes #163 where scan over keyspace is too expensive in deployments with millions of keys -
New context API:
Worker.context,RegisteredTask.context,RegisteredMiddleware.context. DeprecateWorkerDependsandTaskDepends(slated for removal in v7.0.0). Code that looked like:@worker.task async def my_task(task_context: TaskContext = TaskDepends(), worker_context: WorkerContext = WorkerDepends()) -> None: ...
Becomes:
@worker.task async def my_task() -> None: reveal_type(worker.context) # WorkerContext reveal_type(my_task.context) # TaskContext
-
- Reuse lua lib instance in enqueue_many by @alisaifee in #159
- Add documentation for OpenTelemetry integration by @definite-d in #165
New Contributors
- @alisaifee made their first contribution in #159
- @definite-d made their first contribution in #165
Full Changelog: v6.4.0...v6.5.0
tastyware/streaq:v6.4.0
What's Changed
- feat(worker): add max_schedule_drift to @worker.cron() by @matcra587 in #153
New Contributors
- @matcra587 made their first contribution in #153
Full Changelog: v6.3.4...v6.4.0
tastyware/streaq:v6.3.4
What's Changed
Full Changelog: v6.3.3...v6.3.4
tastyware/streaq:v6.3.3
What's Changed
- Fix #146: when worker's event loop was blocked for extended periods of time, it was possible for a worker to reclaim a task it's already running and then crash with a
KeyError. Now a critical message is logged instead so users can migrate their sync tasks without having to worry about crashes.
Full Changelog: v6.3.2...v6.3.3
tastyware/streaq:v6.3.2
What's Changed
- Improve dependency injection
Dependency injection is now less hacky and slightly more performant. Instead of using a class with a special__getattr__forwarded to the dependencies, the actual dependency itself is passed at call time. This allows for a broader definition of dependencies (using aNamedTupleordataclassand only accessing properties via attributes is no longer strictly required) while maintaining backwards compatibility. - Add an
lru_cachedecorator to expensive calls in the web UI endpoints for better performance
Full Changelog: v6.3.1...v6.3.2
tastyware/streaq:v6.3.1
What's Changed
- Fixes a bug where new UI routes didn't work when mounting on an existing FastAPI app
Full Changelog: v6.3.0...v6.3.1