AshciR / group-chat-digest

0 stars 0 forks source link

Remove application polling when started #9

Closed AshciR closed 6 months ago

AshciR commented 7 months ago

Having the bot poll the Telegram API is not an effective way to check for updates. The bot documentation suggested to use a different method before deploying to production.

AshciR commented 6 months ago

https://docs.python-telegram-bot.org/en/stable/telegram.ext.application.html#telegram.ext.Application.run_polling

AshciR commented 6 months ago

Upon further research, we do not need to use a different method for polling. The examples within the documentation use .run_polling(). The reason to use a different approach is if we're using asynicio with other processes.

When combining python-telegram-bot with other asyncio based frameworks, using this method is likely not the best choice, as it blocks the event loop until it receives a stop signal as described above. Instead, you can manually call the methods listed below to start and shut down the application and the updater. Keeping the event loop running and listening for a stop signal is then up to you.