Fix iter_dialogs missing many dialogs

This commit is contained in:
Lonami 2019-04-16 13:00:18 +02:00 committed by GitHub
parent 0b6d766f0c
commit 4c1555cc5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,13 +70,13 @@ class _DialogsIter(RequestIter):
# we didn't get a DialogsSlice which means we got all.
return True
if self.request.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.
return True
self.request.offset_id = r.messages[-1].id
# Don't set `request.offset_id` to the last message ID.
# Why? It seems to cause plenty of dialogs to be skipped.
#
# By leaving it to 0 after the first iteration, even if
# the user originally passed another ID, we ensure that
# it will work correctly.
self.request.offset_id = 0
self.request.exclude_pinned = True
self.request.offset_date = r.messages[-1].date
self.request.offset_peer =\