Skip to content

v0.22.0

Choose a tag to compare

@janbjorge janbjorge released this 09 May 09:10
· 217 commits to main since this release

PGQueuer v0.22.0 — soft-breaking release 🚦

Overview
v0.22.0 introduces real-time job completion and a lightweight schema tweak that powers dramatic speedups. Your workflows will continue to run unchanged, but without the database upgrade you’ll see up to 20× slower status queries—hence the “soft-breaking” label.


🔶 Soft-Breaking Change: New Index Required

  • What: A composite index …_job_id_status on queue_table_log.

  • Why: Accelerates the new job_status() calls and underpins the CompletionWatcher mechanism.

  • Impact if skipped: Workers fall back to sequential scans for status lookups—expect 10–20× latency when awaiting or monitoring jobs.

  • Fix:

    pgq upgrade

✨ Major Features & Improvements

  • CompletionWatcher API

    • Await any job (or group) via LISTEN/NOTIFY + 5 s safety-poll + 50 ms debounce

    • Usage:

      from pgqueuer.completion import CompletionWatcher
      
      async with CompletionWatcher(driver) as w:
          status = await w.wait_for(job_id)  # "successful", "exception", …
    • Helpers: wait_for_all(), wait_for_first() for bulk scripts/tests

  • AsyncpgPoolDriver

    • Pooled connections are now the recommended default in docs/examples
    • Single-connection AsyncpgDriver remains supported

🛠️ Migration Guide

  1. Upgrade your schema

    pgq upgrade
  2. (Optional) Adopt CompletionWatcher

    from pgqueuer.completion import CompletionWatcher
    async with CompletionWatcher(driver) as w:
        await w.wait_for(job_id)

[Full changelog](v0.21.0...v0.22.0)