mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-11-10 22:50:59 +08:00
With cache-batch-size/-timeout set (ntfy.sh: 100 / 1500ms), accepted messages wait in a BatchingQueue before they are written. Nothing drained that queue on shutdown, and `ntfy serve` did not handle SIGTERM at all (only SIGHUP), so every restart dropped up to one batch timeout's worth of accepted messages from the cache: live subscribers got them, pollers and since= replays never did. - util.BatchingQueue.Close emits the pending elements and closes the output channel (Enqueue after Close is a no-op) - message.Cache.Close closes the queue and waits for the batch writer before closing the database - serve stops the server on SIGTERM/SIGINT and waits for Stop to finish (Run returns as soon as the listeners close); Stop is idempotent now, since the signal handler and serve both call it