Closed zapko closed 2 years ago
You could setup something like supervisord to manage bot process, you can configure restart retries.
For example (will retry in 5 sec):
#!/bin/bash
for (( ; ; ))
do
./bot
sleep 5
done
Thanks, that’s a neat solution!
But in my case telegram bot itself is not the main part of the program it is used as a terminal to do input/output with the running business-logic. I would like to avoid whole app restarting if I/O received recoverable error.
In all the examples and documentation if method
nextUpdateSync
returnsnil
. Proposed way to behave is to log error and exit. But what to do if I want to recover from error by, for instance, restarting bot after 5 minutes. Can you give an example of how it can be done?It is important to me because sometimes telegram servers return
504
, and I don't want to shut down bot because of that.