Repository navigation
Queuert 0.19 lets you lock reads and apply job outcomes from your own transactions, adds experimental batched processors and health signals for failing jobs and overdue chains, and supports REPEATABLE READ and SERIALIZABLE on PostgreSQL and MySQL. It ships the breaking 002_schema_v2 migration and reworks the adapter contracts, so stop 0.18 processes once 0.19 is deployed, and custom adapters need updating.
What's Changed
Breaking Changes
client.applyJobOutcomeandclient.applyJobOutcomesreplacecompleteChain,rescheduleJobandrescheduleJobs. They applyoutput,continueWithorrescheduleto a blocked, pending or running job, all or nothing. Rescheduling a running job returns it to pending and ends its attempt, so a wake that arrives mid-attempt is no longer lost (#10).JobNotReschedulableErrorandJobsNotReschedulableErrorare removed.JobStatusMismatchError,JobsStatusMismatchErrorandJobsAlreadyCompletedErrorare added.- Attempt handlers:
completeis renamedapplyJobOutcomeandfenceis renamedfenceJob. The abort signal moves tojob.signal, and handlers returnPromise<void>. MiddlewarewrapHandlerreceivesjobsandworkerSlot. awaitChain({ chain, ... })takes a single options object.countChains,countJobs,countWorkersandcountWorkerJobstake a batch of filters. They replacecountChainsByTypeName,countJobsByTypeName,countWorkersByTypeNameandcountRunningJobsByWorkerId.listBlockedJobstakeschainTypeName.listChains: theindependentfilter becomesblocking, with the opposite meaning.deleteChainsrefuses a chain that is still blocking another, so dependents must be deleted first.- Batch errors list every offending item:
InvalidJobIdsError,JobsBlockerLimitExceededError,JobsTypeValidationError,UnknownJobTypesError,ChainsNotFoundError,ChainsTypeMismatchError,JobsTypeMismatchError.BlockerLimitExceededErroris renamedJobBlockerLimitExceededError. isTransactionis replaced bygetTransaction.- Schema migration
002_schema_v2on PostgreSQL, SQLite, MySQL/MariaDB and Redis:- It adds the chain
blockingflag, failure-tracking columns and health indexes. - It replaces the write fence, so 0.18 processes get
SchemaFencedErroronce it runs. - A 0.17 database must be migrated with 0.18 first. A fresh install creates the latest schema in one step.
- It adds the chain
- Custom adapters must be updated:
- StateAdapter gains
getChainTails,getJobsBlockers,getTransaction,startJobAttemptswithbatchLimits, and the batched counts. - NotifyAdapter's single-id listeners are replaced by
listenChainsCompleted,listenJobAttemptsLostandlistenJobsScheduled. - ObservabilityAdapter drops
completeJobSpanand addsjobAttemptBatchSize. - Conformance suites are each one
create…ConformanceCases(...)call that returns bound cases.
- StateAdapter gains
@queuert/postgres: thepgprovider opens transactions with a plainBEGINinstead of pinning READ COMMITTED. Set a READ COMMITTED default on Queuert's pool to keep the old behavior.@queuert/redis:maxTransactionTriesbecomestransactionRetry.
Features
- Locked reads:
getJob(s),getChain(s)andgetChainTailJob(s)takelock: "exclusive"inside a transaction.getChainTailJob(s)are no longer experimental. - Batched processors (experimental):
batchAttemptHandlerwith a requiredbatchLimit,applyJobOutcomes,fenceJobs, a{ fail }outcome andJobsTakenByAnotherWorkerError. awaitChainswaits on several chains at once and throwsWaitChainsTimeoutError.- Failure backoff:
JobgainsconsecutiveFailuresandlastRescheduleReason, and reschedules take an optional reason. Backoff follows consecutive failures, and reclaimed attempts back off too. - Health signals:
listJobsandcountJobstakeminConsecutiveFailures.- An overdue chain is a running chain created before a cutoff.
listWorkersfilters byexpired.createHealthDefinitionsandmergeHealthDefinitions(experimental) define failing and overdue thresholds.
- Rollback callbacks can be async, and
TxHooks.isOpenis added. Notify events are sent once per transaction, and workers are woken for pending jobs a transaction held locked. - Types:
- Jobs read without a
typeNameare a union you can narrow bytypeName. continuedTo.statusis typed"blocked" | "pending"when the continuation's type declares blockers.- Blockers accept readonly tuples.
- New exports:
ChainRef,JobRef,ChainFilter,JobFilter,WorkerFilter,RetryConfig,HealthDefinitionandHealthDefinitions.
- Jobs read without a
@queuert/postgresand@queuert/mysql(experimental):- REPEATABLE READ and SERIALIZABLE support, with a
transactionRetryoption and atransaction_conflicterror kind. - PostgreSQL also gains
lock_not_available, and asingleConnectionconformance option for providers like PGlite.
- REPEATABLE READ and SERIALIZABLE support, with a
@queuert/postgres,@queuert/sqlite,@queuert/mysql: they use the globalcrypto, so they load in browsers and edge runtimes.@queuert/otel: thequeuert.job.attempt.batch_sizehistogram is new, along with thequeuert.worker.slotandqueuert.reschedule.reasonspan attributes. Client-applied outcomes emit a workerlessstart job-attemptspan.
Dashboard
- Runs on Solid 2 with TanStack Query. Pages are cached, lists are virtualized, and keyboard widgets are built on Kobalte.
- The redesigned home page shows status chips for:
- due jobs and the oldest one's wait
- job types with no live worker
- workers that lost their lease
- worker utilization
- Failing and overdue labels, chips and Health filters are driven by
healthDefinitions.createDashboardchecks the definitions against the client's job types. - Shows consecutive failures and the reschedule reason. The blocking filter replaces independent.
- Reschedule uses a locked read and answers 409 for a running or completed job.
Bug Fixes and Performance
- Row locks are taken heads-first and blocker-first, which fixes deadlocks when deleting and completing chains.
- Claims take the oldest batches across job types and lock only what they take (PostgreSQL, MySQL, Redis).
- Stopping a worker runner waits for a lease renewal in flight.
- Bulk adapter calls stay linear as batches grow:
- SQLite: one query for all deduplication keys.
- MySQL: fewer statements per operation.
- Redis: a fixed number of round trips to delete many chains.
Packages
All packages released at 0.19.0: queuert, @queuert/postgres, @queuert/sqlite, @queuert/mysql, @queuert/redis, @queuert/nats, @queuert/ipc, @queuert/otel, @queuert/dashboard.