github tastyware/streaq v6.5.0

7 hours ago

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

Don't miss a new streaq release

NewReleases is sending notifications on new releases.