mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-23 05:26:42 +00:00
Fix iter_dialogs missing many dialogs
This commit is contained in:
parent
0b6d766f0c
commit
4c1555cc5f
@ -70,13 +70,13 @@ class _DialogsIter(RequestIter):
|
|||||||
# we didn't get a DialogsSlice which means we got all.
|
# we didn't get a DialogsSlice which means we got all.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if self.request.offset_id == r.messages[-1].id:
|
# Don't set `request.offset_id` to the last message ID.
|
||||||
# In some very rare cases this will get stuck in an infinite
|
# Why? It seems to cause plenty of dialogs to be skipped.
|
||||||
# loop, where the offsets will get reused over and over. If
|
#
|
||||||
# the new offset is the same as the one before, break already.
|
# By leaving it to 0 after the first iteration, even if
|
||||||
return True
|
# the user originally passed another ID, we ensure that
|
||||||
|
# it will work correctly.
|
||||||
self.request.offset_id = r.messages[-1].id
|
self.request.offset_id = 0
|
||||||
self.request.exclude_pinned = True
|
self.request.exclude_pinned = True
|
||||||
self.request.offset_date = r.messages[-1].date
|
self.request.offset_date = r.messages[-1].date
|
||||||
self.request.offset_peer =\
|
self.request.offset_peer =\
|
||||||
|
Loading…
Reference in New Issue
Block a user