From 347db79979139be81e1d9989515640d59fb990d1 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 21 Mar 2019 12:25:19 +0100 Subject: [PATCH] run_until_disconnected() should disconnect() on finally --- telethon/client/updates.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index ca42dfed..6b85de7a 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -16,6 +16,8 @@ class UpdateMethods(UserMethods): try: await self.disconnected except KeyboardInterrupt: + pass + finally: await self.disconnect() def run_until_disconnected(self): @@ -33,6 +35,8 @@ class UpdateMethods(UserMethods): try: return self.loop.run_until_complete(self.disconnected) except KeyboardInterrupt: + pass + finally: self.loop.run_until_complete(self.disconnect()) def on(self, event):