mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-17 03:51:05 +03:00
Fix rare iter_dialogs infinite loop
This commit is contained in:
parent
9c0a22ddd7
commit
d6818f25f5
|
@ -107,6 +107,12 @@ class DialogMethods(UserMethods):
|
||||||
|
|
||||||
req.offset_date = r.messages[-1].date
|
req.offset_date = r.messages[-1].date
|
||||||
req.offset_peer = entities[utils.get_peer_id(r.dialogs[-1].peer)]
|
req.offset_peer = entities[utils.get_peer_id(r.dialogs[-1].peer)]
|
||||||
|
if req.offset_id == r.messages[-1].id:
|
||||||
|
# In some very rare cases this will get stuck in an infinite
|
||||||
|
# loop, where the offsets will get reused over and over. If
|
||||||
|
# the new offset is the same as the one before, break already.
|
||||||
|
break
|
||||||
|
|
||||||
req.offset_id = r.messages[-1].id
|
req.offset_id = r.messages[-1].id
|
||||||
req.exclude_pinned = True
|
req.exclude_pinned = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user