Repository navigation
v0.17.0
What's Changed
Queuert 0.17 moves job completion into your own database transactions and replaces per-job attempt leases with a worker registry, so ownership is fenced end to end. It also batches acquisition and notifications to cut database and broker round trips. This is a breaking release: read the migration notes before upgrading, and run the 002_worker_liveness migration.
Breaking Changes
- Jobs complete inside your own transaction. The handler calls
complete({ ...txCtx, transactionHooks, output | continueWith | reschedule })inside a transaction it opens.prepare,step, the oldcompletecallback, and the atomic/staged processing modes are removed.AttemptMiddlewarekeeps onlywrapHandler. A handler that returns without a committedcompleteis rescheduled with backoff. - Worker registry with per-worker leases.
- Workers register in a new
workertable and hold a lease configured byleaseConfig { durationMs, heartbeatMs }(defaults 60s / 15s). - Attempt tokens fence stale writes. Jobs of expired workers are reclaimed as failed attempts with
JobAttemptReclaimedError. workerNameis nowworkerId.attemptConfig,defaults,InProcessWorkerDefaults,Job.attemptUntilandRetryConfigare removed in favor of a top-levelbackoffConfig.- New errors:
WorkerAlreadyLiveError,WorkerLeaseLostError,InvalidWorkerIdError.
- Workers register in a new
- New
002_worker_livenessmigration for@queuert/postgresand@queuert/sqlite. It returns running jobs to pending, and Postgres gives up after 5s if it cannot take its locks. Jobs claimed by pre-0.17 workers are reclaimed during a rolling upgrade. - The attempt
signalis a plainAbortSignal.JobAbortReasonandTypedAbortSignalare removed. - One
jobAttemptLostevent for every attempt loss. It replacesjobAttemptTakenByAnotherWorkerandjobAttemptAlreadyCompleted.jobAttemptExtended,jobAttemptExpiredandworkerStoppingare removed. - Mutating client methods reject contexts that are not open transactions. State providers must implement
isTransaction. stateAdapter.configadds themaxBlockersPerJobandcountCapoptions. Job IDs are now generated and validated in core.- Batched acquisition:
startJobAttemptis nowstartJobAttempts(limit). - Batched notify adapters for
@queuert/postgres,@queuert/redisand@queuert/nats. Wake hints are removed.PgNotifyProvider.publishtakesmessages[], andRedisNotifyProvider.publishis removed. - NATS now uses the
@nats-io/nats-core^3 peer dependency instead ofnats, and thekvoption is removed. - Renames:
listChainTypeNames/listJobTypeNames→getChainTypeNames/getJobTypeNamescountByChainTypeNames/countByJobTypeNames→countChainsByTypeName/countJobsByTypeNamegenerateId/validateId/idType→generateJobId/validateJobId/jobIdType
- The one-step v0.15.1 upgrade path is removed from
@queuert/postgresand@queuert/sqlite. - OpenTelemetry (
@queuert/otel):queuert.worker.idis removed from metric attributes.- Each attempt is one span; the
prepare,stepandcompletechild spans are gone. queuert.job.attempt.lostreplaces the taken-by-another-worker and already-completed counters. The extended, expired and worker-stopping counters are removed.- New
queuert.worker.lease_lostcounter.
Features
fence({ ...txCtx })checks attempt ownership inside other transactions the handler opens.- Client read API for workers:
getWorker,getWorkers,countWorkers,countWorkersByTypeName,countRunningJobsByWorkerId,listWorkers,listWorkerJobs. - Blockers can be passed by ID (
{ id, typeName? }). pickProcessors/omitProcessors, with a compile-time check for overlapping processors.- New
workerIdTypeoption for the Postgres and SQLite state adapters. - Dashboard:
- Workers pages and worker links, with warnings for lost leases and for job types that have no live worker.
- Types can be filtered by status, and the find dialog finds types with fzf-style matching.
- Restyled, with the version shown in the top bar.
Bug Fixes
- Schedule, reschedule, timeout and
awaitChaindelays beyond 2^31-1 ms (about 24.8 days) now work. On Postgres the worker no longer fails when the nearest scheduled job is that far away (#5, #6). - Recovery backoff resets after the worker recovers.
- Concurrent
migrateToLatest()runs apply each migration exactly once, and a lost migration lease is no longer silently re-acquired (#7). - Postgres:
- fractional delays work
- list cursors keep microsecond precision
- acquisition locks only the job row
- time comparisons use statement time
- Worker config is validated when the worker is created.
- Dashboard:
- workers are notified only after a reschedule or delete commits
- list filters are unified into a single filter bar
Packages
All packages released at 0.17.0: queuert, @queuert/postgres, @queuert/sqlite, @queuert/redis, @queuert/nats, @queuert/otel, @queuert/dashboard.