Catch FloodWaits when calling GetContacts
This commit is contained in:
parent
314d19e09d
commit
2a9da07548
@ -2351,7 +2351,14 @@ class Client:
|
||||
)
|
||||
|
||||
def get_contacts(self, _hash: int = 0):
|
||||
while True:
|
||||
try:
|
||||
contacts = self.send(functions.contacts.GetContacts(_hash))
|
||||
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 New Issue
Block a user