From 5731cf015e1539c67100c06eea221c318dae8535 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Mon, 6 Aug 2018 15:33:06 +0200 Subject: [PATCH] Fix timeout not occuring where expected --- telethon/client/updates.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index 749a8859..931d52fd 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -199,7 +199,9 @@ class UpdateMethods(UserMethods): rnd = lambda: random.randrange(-2**63, 2**63) while self.is_connected(): try: - concurrent.futures.wait([self.disconnected], timeout=60) + next(concurrent.futures.as_completed( + [self.disconnected], timeout=60)) + continue # We actually just want to act upon timeout except concurrent.futures.TimeoutError: pass