Skip to content

v2.3.0

Choose a tag to compare

@janbjorge janbjorge released this 03 Dec 18:19
· 5 commits to main since this release
dee4f0e

PgQueuer v2.3.0

PgQueuer v2.3.0 keeps the cancel request of a picked job in its row, claims due jobs first within a priority, accepts a pydantic model as a job payload, and fixes poll, cancel, schema and driver bugs.

Run pgq upgrade before starting workers. This release adds the column cancel_requested to pgqueuer; workers do not start until it exists. It rebuilds pgqueuer_ep_prio_id_idx; the build blocks writes to pgqueuer.

Changed

  • Within one priority, a dequeue takes the job that became due first, then the lowest id. Before, it read past every job in retry backoff (#1132).
  • next_deferred_eta reads one index entry per entrypoint (#1170). The web /healthz reads one row by primary key (#1176).
  • Re-export modules drop __all__. Every public name still imports; from pgqueuer import * now also binds submodule names (#1217).
  • Internal: persistence internals change under ADR-0028. The dequeue template classes and pgqueuer.adapters.persistence.composer are removed; SQL and arguments do not change (#1206, #1209, #1211).
  • Internal: module constants in the in-memory adapter, schema code, web dashboard, pgqueuer.core.insights and tracing adapters become functions. pgqueuer.adapters.cli.cli.app becomes create_app(), and has_logfire(), has_otel() and has_sentry() replace the HAS_ flags (#1212, #1213, #1214, #1218).

Highlights

  • The single-job form of enqueue() accepts a pydantic model and stores its JSON; job.payload_as(Model) decodes it. The batch form and QueueRepositoryPort stay bytes (#1239).
  • pgqueuer exports the names the docs import: AbstractEntrypointExecutor, CompletionWatcher, ConnectionSettings, Context, LogfireTracing, OpenTelemetryTracing, QueueExecutionMode, Schedule, ScheduleContext, SentryTracing, SyncPsycopgDriver, SyncQueries, connect_asyncpg, create_asyncpg_pool and create_psycopg_pool (#1235).
  • The wheel ships the agent guide as an agent skill; uvx library-skills installs it (#1238).
  • A FastAPI guide, with a worker in the app lifespan and a transactional enqueue on a pool connection (#1236, #1237, #1241).
  • A worker that takes over a picked job after a crash or a lost NOTIFY logs a requested cancel as canceled and does not run the job (#1088).
  • QueueManager retries a failed poll; three failures in a row still end the run (#1169).
  • A CancelledError from job code fails the job when no cancel was requested (#1191). A cancel of many jobs is split into several NOTIFYs and logs each job once (#1192).
  • Each cron tick runs once under clock skew and query latency (#1193).
  • A dequeue without concurrency limits clears the slot that a retried, held or requeued job kept (#1182).
  • Traces show a failed job as an error (#1173). A lone surrogate in an error text no longer fails the log write (#1171, #1172).
  • Job headers and log tracebacks that are not a JSON object read as None (#1185, #1195, #1201).
  • pgq uninstall and pgq verify --expect absent run the search_path guard (#1184). pgq durability changes one table at a time (#1186). pgq upgrade notes each index build (#1187). A rerun of pgq sql upgrade takes no locks on a current database (#1188).
  • pgq run --pg-dsn gives the DSN to user factories through PGQUEUER_DSN (#1190). pgq requeue says that only failed jobs move (#1177).
  • PsycopgDriver no longer loses a callback when listeners are added or removed at the same time (#1224). AsyncpgDriver accepts a pool.acquire() connection under strict mypy (#1240).
  • Prometheus service: label values are escaped (#1174), and /health returns 500 on a lost connection (#1189, #1196).
  • The dashboard overview shows recent held failures in their own card (#1181). The in-memory adapter delivers retried, requeued and higher-priority jobs (#1183).
  • Deleting stale schedules no longer keeps every row when the keep list holds a NULL (#1199).

Full Changelog: v2.2.0...v2.3.0