Skip to catalogue

75

graceful shutdown

On SIGTERM, stop taking work, finish what you started, then exit. Do not drop the request mid-write.

What is graceful shutdown?

Graceful shutdown is the process lifecycle at the end: catch the signal, stop the listener, drain in-flight requests and jobs, close pools, then exit 0. Kill -9 is not a strategy.

Why does graceful shutdown matter when vibe coding?

Deploys send SIGTERM. Models ignore it. A rolling restart then cuts payments in half. Name drain and a deadline.

How do you do graceful shutdown?

Handle SIGTERM and SIGINT. `server.close()`. Stop fetching new jobs. Wait up to N seconds. Then disconnect the pool. Log that you drained.

How do you ask a model for graceful shutdown?

Handle SIGTERM. Stop accepting connections, finish in-flight requests, stop the worker after the current job, close the pool, then exit. Bound the wait.

What goes wrong with graceful shutdown?

Awaiting the drain with no timeout. A stuck request then blocks the deploy forever.

adjacent