mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-05 23:04:51 +00:00
Catch FloodWaits when calling GetContacts
This commit is contained in:
parent
314d19e09d
commit
2a9da07548
1 changed files with 11 additions and 4 deletions
|
|
@ -2351,7 +2351,14 @@ class Client:
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_contacts(self, _hash: int = 0):
|
def get_contacts(self, _hash: int = 0):
|
||||||
contacts = self.send(functions.contacts.GetContacts(_hash))
|
while True:
|
||||||
self.fetch_peers(contacts.users)
|
try:
|
||||||
|
contacts = self.send(functions.contacts.GetContacts(_hash))
|
||||||
return contacts
|
except FloodWait as e:
|
||||||
|
log.info("Get contacts flood wait: {}".format(e.x))
|
||||||
|
time.sleep(e.x)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
log.info("Contacts count: {}".format(len(contacts.users)))
|
||||||
|
self.fetch_peers(contacts.users)
|
||||||
|
return contacts
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue