Repository navigation
v2.3.0
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_etareads one index entry per entrypoint (#1170). The web/healthzreads 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.composerare removed; SQL and arguments do not change (#1206, #1209, #1211). - Internal: module constants in the in-memory adapter, schema code, web dashboard,
pgqueuer.core.insightsand tracing adapters become functions.pgqueuer.adapters.cli.cli.appbecomescreate_app(), andhas_logfire(),has_otel()andhas_sentry()replace theHAS_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 andQueueRepositoryPortstaybytes(#1239). pgqueuerexports the names the docs import:AbstractEntrypointExecutor,CompletionWatcher,ConnectionSettings,Context,LogfireTracing,OpenTelemetryTracing,QueueExecutionMode,Schedule,ScheduleContext,SentryTracing,SyncPsycopgDriver,SyncQueries,connect_asyncpg,create_asyncpg_poolandcreate_psycopg_pool(#1235).- The wheel ships the agent guide as an agent skill;
uvx library-skillsinstalls 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
canceledand does not run the job (#1088). QueueManagerretries a failed poll; three failures in a row still end the run (#1169).- A
CancelledErrorfrom 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 uninstallandpgq verify --expect absentrun thesearch_pathguard (#1184).pgq durabilitychanges one table at a time (#1186).pgq upgradenotes each index build (#1187). A rerun ofpgq sql upgradetakes no locks on a current database (#1188).pgq run --pg-dsngives the DSN to user factories throughPGQUEUER_DSN(#1190).pgq requeuesays that only failed jobs move (#1177).PsycopgDriverno longer loses a callback when listeners are added or removed at the same time (#1224).AsyncpgDriveraccepts apool.acquire()connection under strict mypy (#1240).- Prometheus service: label values are escaped (#1174), and
/healthreturns 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