Skip to content

Commit b70d1ef

Browse files
authored
Don't drop pending Telegram updates on restart (#171)
The startup path (every `nerve restart` / daemon respawn goes through it) called Updater.start_polling(drop_pending_updates=True), telling Telegram to discard every update queued while the bot was offline. Any message a user sent during the restart window was silently dropped and never redelivered. Set drop_pending_updates=False so a restart replays the backlog Telegram retains (~24h; the read offset only advances once we fetch them). This matches the watchdog _rebuild() path, which already uses False.
1 parent f1b0cff commit b70d1ef

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

nerve/channels/telegram.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,15 @@ async def start(self) -> None:
332332
await self._app.initialize()
333333
await self._app.start()
334334
await self._app.updater.start_polling(
335-
drop_pending_updates=True,
335+
# Do NOT drop updates that queued while we were offline.
336+
# `nerve restart` (and any daemon respawn) goes through this
337+
# startup path; with drop_pending_updates=True, every message
338+
# the user sent during the restart window was silently discarded
339+
# by Telegram and never redelivered — a real "lost message" bug.
340+
# Telegram retains updates ~24h and only advances the offset once
341+
# we fetch them, so False makes a restart pick up the backlog.
342+
# The watchdog _rebuild() path already uses False; keep parity.
343+
drop_pending_updates=False,
336344
# Retry initial connection indefinitely — don't give up on
337345
# transient network errors during startup
338346
bootstrap_retries=-1,

0 commit comments

Comments
 (0)