0

I'm currently running a telegram bot using the node-telegram-bot-api. But now the project is getting bigger and bigger and more users are using my bot. So I had some difficulties when I had to re-deploy my app while many people are still on access. I tried to run multiple clusters using pm2 and then use pm2 reload to gracefully restart my app in zero downtime.

But then I got an error from telegram:

error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}

I think telegram doesn't provide multiple instances in the same server. Is there any solutions for this kind of problem?

Alex Won
  • 177
  • 2
  • 11

1 Answers1

1

Even if you could run script twice, users will get answers twice when they sends commands to bot. you have two options two do:

  • Upgrade Your resources (RAM/CPU/...)
  • Handle incoming messages with your main script, make a API and do processes in API backend.
Purya
  • 123
  • 7