1

I have a telegram bot with over 60k users. And broadcasting a message to all those users takes more than 15 hours to complete. But my bot is running on GitHub workflows. And the bot gets restarted every 6 hours. So if I have a broadcast in progress, it stops after the restart. So I need a way to save the progress of the the broadcast process at the time of the restart and after the restart the bot checks for any incompleted broadcast processes and resume the process from where it was stopped?

Database that I use: Mongo db API Framework: Pyrogram

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Shaheen M
  • 36
  • 5
  • If the broadcast have an order, just store the last user it was successfully broadcasted and start broadcasting from there after the restart. You are using a DB, store that index in the database before restating. –  Sep 14 '22 at 15:08
  • @SembeiNorimaki at the same time how to make the bot fetch for incomplete broadcast processes?. – Shaheen M Sep 14 '22 at 15:34
  • there shouldn't be incomplete broadcast processes. Some minutes before the restart you should stop the broadcast. But if you get some incomplete broadcasts, just broadcast them again. You save the index only after correctly broadcasting, so if a broadcast is interrupted the index for that user will not be saved and it will be broadcasted again –  Sep 14 '22 at 15:36

0 Answers0