github tastyware/streaq v7.0.0

7 hours ago

What's Changed

  • Drop Python 3.10 support: Minimum version is now 3.11.
  • Remove deprecated DI helpers: TaskDepends() and WorkerDepends() are gone. Use my_task.context/my_middleware.context/worker.context instead.
  • Remove deprecated health_crontab parameter from Worker, doesn't do anything since health check was refactored.
  • Async serializer/deserializer support: the serializer and deserializer parameters to Worker now accept both sync and async callables. This can be used to send expensive calls to threads (make sure threading is actually beneficial; see #145).
  • TaskStatus now inherits from StrEnum (was str, Enum).
  • Bump coredis to >=6.7.0; add pytest-randomly to 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_tasks background 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 XREADGROUP with BLOCK to block for much longer periods of time.
    • run_task pipeline optimized and no longer uses gather. Per-task fn closure replaced with a cached runner property on registered tasks, so sync tasks get asyncify applied once instead of on every run.
    • Cached _async_serializer/_async_deserializer flags at init rather than calling inspect.isawaitable per serializer call.
    • Chained tasks now publish through one _recurse pass 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.

Full Changelog: v6.5.2...v7.0.0

Don't miss a new streaq release

NewReleases is sending notifications on new releases.