Skip to content

Commit 881d1d0

Browse files
committed
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.
1 parent cb6ddfd commit 881d1d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

telegram/ext/updater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def stop(self):
346346

347347
self.job_queue.stop()
348348
with self.__lock:
349-
if self.running:
349+
if self.running or dispatcher.ASYNC_THREADS:
350350
self.logger.debug('Stopping Updater and Dispatcher...')
351351

352352
self.running = False

0 commit comments

Comments
 (0)