mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
Merge pull request #69 from EriHoss/stop_getfile_sessions
Make sure started Session is always stopped upon exceptions in Client.get_file
This commit is contained in:
commit
11aa46665e
1 changed files with 10 additions and 6 deletions
|
|
@ -2988,13 +2988,17 @@ class Client:
|
|||
)
|
||||
|
||||
session.start()
|
||||
|
||||
session.send(
|
||||
functions.auth.ImportAuthorization(
|
||||
id=exported_auth.id,
|
||||
bytes=exported_auth.bytes
|
||||
try:
|
||||
session.send(
|
||||
functions.auth.ImportAuthorization(
|
||||
id=exported_auth.id,
|
||||
bytes=exported_auth.bytes
|
||||
)
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
session.stop()
|
||||
raise e
|
||||
|
||||
else:
|
||||
session = Session(
|
||||
dc_id,
|
||||
|
|
|
|||
Loading…
Reference in a new issue