mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 21:38:04 +00:00
Handle GetDialogs FloodWait errors
This commit is contained in:
parent
6783d7b16f
commit
403a37692c
@ -495,12 +495,17 @@ class Client:
|
|||||||
log.info("Dialogs count: {}".format(len(peers)))
|
log.info("Dialogs count: {}".format(len(peers)))
|
||||||
|
|
||||||
while len(dialogs.dialogs) == self.DIALOGS_AT_ONCE:
|
while len(dialogs.dialogs) == self.DIALOGS_AT_ONCE:
|
||||||
dialogs = self.send(
|
try:
|
||||||
functions.messages.GetDialogs(
|
dialogs = self.send(
|
||||||
offset_date, 0, types.InputPeerEmpty(),
|
functions.messages.GetDialogs(
|
||||||
self.DIALOGS_AT_ONCE, True
|
offset_date, 0, types.InputPeerEmpty(),
|
||||||
|
self.DIALOGS_AT_ONCE, True
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
except FloodWait as e:
|
||||||
|
log.info("Get dialogs flood wait: {}".format(e.x))
|
||||||
|
time.sleep(e.x)
|
||||||
|
continue
|
||||||
|
|
||||||
offset_date = parse_dialogs(dialogs)
|
offset_date = parse_dialogs(dialogs)
|
||||||
log.info("Dialogs count: {}".format(len(peers)))
|
log.info("Dialogs count: {}".format(len(peers)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user