Skip to content

[BUG] Graceful shutdown only triggers on Ctrl+C, not SIGTERM #12

Description

@Hogwarts-coder10

Location: server.py — shutdown logic lives in except KeyboardInterrupt:

Problem:

store.shutdown() (which flushes + fsyncs + closes the AOF file) only runs if the process receives SIGINT. A kill on Linux sends SIGTERM by default and skips this path entirely — the last AOF write may never reach disk.

Fix:

import signal
signal.signal(signal.SIGTERM, lambda *_: server.shutdown())

Matters once this runs as a managed/daemon process rather than a foreground terminal session.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions