From 881d1d0e25d449b1cbe097dd58004688ceceff03 Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Fri, 17 Jun 2016 23:53:18 +0300 Subject: [PATCH] fix/hack Updater.stop() not working on extreme cases during test_bootstrap_retries_fail() there is an exception raised (by design): TelegramError('test') For a reason I haven't managed to pinpoint the above exception in its precise timing caused the Updater to be left in a state which is 'self.running == False', but the dispatcher threads already initialized. This patch identifies this extreme case and makes sure to go over the stop procedure. --- telegram/ext/updater.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telegram/ext/updater.py b/telegram/ext/updater.py index b958d6550..7fb19c569 100644 --- a/telegram/ext/updater.py +++ b/telegram/ext/updater.py @@ -346,7 +346,7 @@ class Updater(object): self.job_queue.stop() with self.__lock: - if self.running: + if self.running or dispatcher.ASYNC_THREADS: self.logger.debug('Stopping Updater and Dispatcher...') self.running = False