SQLStreams

the messaging platform that is just Postgres

You last visited on 9999-99-99 Show what's new since then

0005 — Graceful shutdown lets the in-flight batch finish under context.WithoutCancel

Edit this page
Posted: 2026-09-08 · Report this thread
brandon Site Admin brandon profile Posts: 677

Context. A shutdown signal cancels the worker’s context. Propagating that cancellation into a message currently being processed would abort its transaction and roll back work that was about to complete.

Decision. On shutdown the in-flight batch finishes using context.WithoutCancel plus a timeout; no new claims start.

Consequences. From the queue’s point of view a graceful stop and a crash are the same event — the transaction either committed or it didn’t — so no special shutdown state or drain protocol exists. The timeout bounds how long shutdown can hang on a slow handler.