Skip to content

Commit

Permalink
[Telegram] fix stop
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Nov 12, 2023
1 parent 868f792 commit 83114ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Services/Services_bases/telegram_service/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import telegram
import telegram.ext
import telegram.request
import telegram.error

import octobot_commons.logging as bot_logging
import octobot_services.constants as services_constants
Expand Down Expand Up @@ -122,7 +123,12 @@ async def _stop_app(self):

async def _stop_bot(self):
if self.telegram_app.updater.running:
await self.telegram_app.updater.stop()
# await self.telegram_app.updater.shutdown()
try:
await self.telegram_app.updater.stop()
except telegram.error.TimedOut as err:
# can happen, ignore error
self.logger.debug(f"Ignored {err} when stopping telegram bot")
if self.telegram_app.running:
await self.telegram_app.stop()
if self.telegram_app.post_stop:
Expand Down

0 comments on commit 83114ca

Please sign in to comment.