Skip to content

Commit 30b216e

Browse files
author
Pietro Albini
committed
Be sure to skip the last backlog update
The instantaneous backlog processing introduced in commit 02a98fe didn't skip the last backlog update, which wasn't the past and correct behavior. This commit fixes this regression. Regression-of: 02a98fe
1 parent ae832cc commit 30b216e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

botogram/updates.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,17 @@ def fetch(self, timeout=1):
5454
"""Fetch the latest updates"""
5555
if not self._backlog_processed:
5656
# Just erase all the previous messages
57-
self._bot.api.call("getUpdates", {
57+
last = self._bot.api.call("getUpdates", {
5858
"offset": -1,
5959
"timeout": 0,
6060
}, expect=objects.Updates)
6161

62+
# Be sure to skip also the last update
63+
if last:
64+
self._last_id = last[-1].update_id
65+
else:
66+
self._last_id = 0
67+
6268
self._backlog_processed = True
6369

6470
updates = self._fetch_updates(timeout)

0 commit comments

Comments
 (0)