Skip to content

v0.19.0

Latest

Choose a tag to compare

@kvet kvet released this 29 Nov 08:35
· 1 commit to main since this release
Immutable release. Only release title and notes can be modified.
v0.19.0
4ca710d

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.applyJobOutcome and client.applyJobOutcomes replace completeChain, rescheduleJob and rescheduleJobs. They apply output, continueWith or reschedule to 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). JobNotReschedulableError and JobsNotReschedulableError are removed. JobStatusMismatchError, JobsStatusMismatchError and JobsAlreadyCompletedError are added.
  • Attempt handlers: complete is renamed applyJobOutcome and fence is renamed fenceJob. The abort signal moves to job.signal, and handlers return Promise<void>. Middleware wrapHandler receives jobs and workerSlot.
  • awaitChain({ chain, ... }) takes a single options object.
  • countChains, countJobs, countWorkers and countWorkerJobs take a batch of filters. They replace countChainsByTypeName, countJobsByTypeName, countWorkersByTypeName and countRunningJobsByWorkerId. listBlockedJobs takes chainTypeName.
  • listChains: the independent filter becomes blocking, with the opposite meaning. deleteChains refuses 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. BlockerLimitExceededError is renamed JobBlockerLimitExceededError.
  • isTransaction is replaced by getTransaction.
  • Schema migration 002_schema_v2 on PostgreSQL, SQLite, MySQL/MariaDB and Redis:
    • It adds the chain blocking flag, failure-tracking columns and health indexes.
    • It replaces the write fence, so 0.18 processes get SchemaFencedError once it runs.
    • A 0.17 database must be migrated with 0.18 first. A fresh install creates the latest schema in one step.
  • Custom adapters must be updated:
    • StateAdapter gains getChainTails, getJobsBlockers, getTransaction, startJobAttempts with batchLimits, and the batched counts.
    • NotifyAdapter's single-id listeners are replaced by listenChainsCompleted, listenJobAttemptsLost and listenJobsScheduled.
    • ObservabilityAdapter drops completeJobSpan and adds jobAttemptBatchSize.
    • Conformance suites are each one create…ConformanceCases(...) call that returns bound cases.
  • @queuert/postgres: the pg provider opens transactions with a plain BEGIN instead of pinning READ COMMITTED. Set a READ COMMITTED default on Queuert's pool to keep the old behavior.
  • @queuert/redis: maxTransactionTries becomes transactionRetry.

Features

  • Locked reads: getJob(s), getChain(s) and getChainTailJob(s) take lock: "exclusive" inside a transaction. getChainTailJob(s) are no longer experimental.
  • Batched processors (experimental): batchAttemptHandler with a required batchLimit, applyJobOutcomes, fenceJobs, a { fail } outcome and JobsTakenByAnotherWorkerError.
  • awaitChains waits on several chains at once and throws WaitChainsTimeoutError.
  • Failure backoff: Job gains consecutiveFailures and lastRescheduleReason, and reschedules take an optional reason. Backoff follows consecutive failures, and reclaimed attempts back off too.
  • Health signals:
    • listJobs and countJobs take minConsecutiveFailures.
    • An overdue chain is a running chain created before a cutoff.
    • listWorkers filters by expired.
    • createHealthDefinitions and mergeHealthDefinitions (experimental) define failing and overdue thresholds.
  • Rollback callbacks can be async, and TxHooks.isOpen is added. Notify events are sent once per transaction, and workers are woken for pending jobs a transaction held locked.
  • Types:
    • Jobs read without a typeName are a union you can narrow by typeName.
    • continuedTo.status is typed "blocked" | "pending" when the continuation's type declares blockers.
    • Blockers accept readonly tuples.
    • New exports: ChainRef, JobRef, ChainFilter, JobFilter, WorkerFilter, RetryConfig, HealthDefinition and HealthDefinitions.
  • @queuert/postgres and @queuert/mysql (experimental):
    • REPEATABLE READ and SERIALIZABLE support, with a transactionRetry option and a transaction_conflict error kind.
    • PostgreSQL also gains lock_not_available, and a singleConnection conformance option for providers like PGlite.
  • @queuert/postgres, @queuert/sqlite, @queuert/mysql: they use the global crypto, so they load in browsers and edge runtimes.
  • @queuert/otel: the queuert.job.attempt.batch_size histogram is new, along with the queuert.worker.slot and queuert.reschedule.reason span attributes. Client-applied outcomes emit a workerless start job-attempt span.

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. createDashboard checks 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.