Skip to content

Breaking changes for v7.0.0 - #169

Merged
Graeme22 merged 8 commits into
masterfrom
v7
Jun 2, 2026
Merged

Breaking changes for v7.0.0#169
Graeme22 merged 8 commits into
masterfrom
v7

Conversation

@Graeme22

@Graeme22 Graeme22 commented May 28, 2026

Copy link
Copy Markdown
Member

Description

  • 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 when not using the GIL or when using functions that release the GIL (see Sync serializer/deserializer calls block the async event loop #145). All internal callers updated to await them.
  • TaskStatus now inherits from StrEnum (was str, Enum).
  • Bump coredis to >=6.7.0; add pytest-randomly dev dependency.
  • Dropped the SAQ benchmark; refreshed benchmark numbers for v7.0.0.
  • Performance improvements to the worker hot path
    Reworks the producer/consumer loop and task execution path to cut per-task overhead, plus consolidates task-publishing logic that was duplicated across three call sites.
    • 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.
    • Replaced per-iteration buffer-stat recomputation with a single _count counter.
    • Stream entries are sent directly to the queue via send_nowait 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 switched from transaction=True with an eager gather to transaction=False with lazy awaits, so reads resolve only when needed.
    • Per-task fn closure replaced with a cached runner property on registered tasks — 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 (de)serialization.
    • Consolidated the duplicated enqueue logic from Task._enqueue, Task._chain, and enqueue_many into a single Worker.publish_task helper.
    • Chained tasks now publish through one _recurse pass over a single transaction pipeline.
    • Added coverage for burst shutdown after execution, no-grace-period shutdown under load, and querying queued tasks by status.

Related issue(s)

Fixes #145

Pre-merge checklist

  • Code formatted correctly (check with make lint)
  • Passing tests locally (check with make test)
  • New tests added (if applicable)
  • Docs updated (if applicable)

@Graeme22
Graeme22 merged commit 01ae8fa into master Jun 2, 2026
4 of 5 checks passed
@Graeme22
Graeme22 deleted the v7 branch June 2, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync serializer/deserializer calls block the async event loop

1 participant