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.
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:
Matters once this runs as a managed/daemon process rather than a foreground terminal session.