Skip to content

Releases: tastyware/streaq

v7.1.0

Choose a tag to compare

@Graeme22 Graeme22 released this 17 Jun 21:32

What's Changed

  • Add optional retry-on-timeout handling by @Poyraxx in #171
    Adds a retry_timeouts parameter 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

Choose a tag to compare

@Graeme22 Graeme22 released this 02 Jun 01:40
01ae8fa

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

v6.5.2

Choose a tag to compare

@Graeme22 Graeme22 released this 27 May 18:34

What's Changed

  • add missing status info to Worker.info_by_id()
  • change badge color in UI for failed tasks (#168)

Full Changelog: v6.5.1...v6.5.2

v6.5.1

Choose a tag to compare

@Graeme22 Graeme22 released this 26 May 18:26

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

Choose a tag to compare

@Graeme22 Graeme22 released this 22 May 23:03
fdf3a8c

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_task fails, backup_task will run with the same arguments. Read more here.

    • Replace SCAN-based _get_running_tasks/_get_completed_tasks with 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. Deprecate WorkerDepends and TaskDepends (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

Full Changelog: v6.4.0...v6.5.0

tastyware/streaq:v6.4.0

Choose a tag to compare

@Graeme22 Graeme22 released this 10 Apr 18:47

What's Changed

  • feat(worker): add max_schedule_drift to @worker.cron() by @matcra587 in #153

New Contributors

Full Changelog: v6.3.4...v6.4.0

tastyware/streaq:v6.3.4

Choose a tag to compare

@Graeme22 Graeme22 released this 10 Apr 02:50
35bec3a

What's Changed

Full Changelog: v6.3.3...v6.3.4

tastyware/streaq:v6.3.3

Choose a tag to compare

@Graeme22 Graeme22 released this 01 Apr 23:59

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

Choose a tag to compare

@Graeme22 Graeme22 released this 26 Mar 16:03

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 a NamedTuple or dataclass and only accessing properties via attributes is no longer strictly required) while maintaining backwards compatibility.
  • Add an lru_cache decorator to expensive calls in the web UI endpoints for better performance

Full Changelog: v6.3.1...v6.3.2

tastyware/streaq:v6.3.1

Choose a tag to compare

@Graeme22 Graeme22 released this 24 Mar 00:54

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