Problem
Quart does not currently handle SIGINT or SIGTERM. Stopping the process can leave the Baileys socket, QR web server, and SQLite connection to be cleaned up only by the operating system.
This makes local development and process-manager deployments less predictable and can leave in-memory state or pending writes without a deliberate shutdown path.
Expected behavior
A normal shutdown signal should stop active services cleanly and then exit without triggering a reconnect.
Suggested direction
Keep a reference to the active socket, add a small shutdown function, call stopQRHost(), close the database through an exported helper, and guard the connection-close handler so it does not reconnect during shutdown.
Acceptance criteria
SIGINT and SIGTERM invoke the same idempotent shutdown path.
- The QR server and database are closed when they are active.
- Shutdown does not start a new WhatsApp connection.
- A second signal or repeated shutdown call is harmless.
Problem
Quart does not currently handle
SIGINTorSIGTERM. Stopping the process can leave the Baileys socket, QR web server, and SQLite connection to be cleaned up only by the operating system.This makes local development and process-manager deployments less predictable and can leave in-memory state or pending writes without a deliberate shutdown path.
Expected behavior
A normal shutdown signal should stop active services cleanly and then exit without triggering a reconnect.
Suggested direction
Keep a reference to the active socket, add a small shutdown function, call
stopQRHost(), close the database through an exported helper, and guard the connection-close handler so it does not reconnect during shutdown.Acceptance criteria
SIGINTandSIGTERMinvoke the same idempotent shutdown path.