Skip to content

Commit e469c51

Browse files
committed
ci(compose): give the worker 60s to drain on SIGTERM
Without stop_grace_period, docker SIGKILLs containers 10s after SIGTERM. For the huey worker that means an in-flight mail send, periodic close_due task, or DB transaction can be cut mid-way — the mail is half-delivered, the row is mid-commit, or the next worker will reprocess the same task without idempotency keys (which we now have for mail). 60s matches gunicorn's --graceful-timeout from docker-entrypoint.sh and leaves headroom for the longest realistic in-flight task.
1 parent 3b007dc commit e469c51

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

compose.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ services:
4747
<<: [*service-base, *app-security]
4848
container_name: struudel-worker
4949
command: ["worker"]
50+
# Give huey_consumer time to drain in-flight tasks on SIGTERM —
51+
# docker's default 10s would SIGKILL mid-mail-send or mid-DB-txn.
52+
stop_grace_period: 60s
5053
# python is already in the image; scan /proc instead of pulling in
5154
# procps just for `pgrep`. Exits 0 if any process has huey_consumer
5255
# in its argv, else 1.

0 commit comments

Comments
 (0)