tgbot-cpp
tgbot-cpp copied to clipboard
TgLongPoll locks the thread after working some time
So, the problem is that I have such code which start the whole bot workflow:
while (true) { try { setEvents(); printf("Bot username: %s\n", bot->getApi().getMe()->username.c_str()); TgBot::TgLongPoll longPoll(*bot); while (true) { printf("Long poll started\n"); longPoll.start(); } } catch (...) { printf("Error. Restart is happening \n"); bot.reset(new Bot{ token }); } }
After some time of bot working, the longPoll.start() locks the whole thread and stops doing anything. is there a reason for such behaviour and is there a way to handle it?
No, that's not supposed to happen. How long does it take for the thread to be locked?
The main problem is that I don't know any reason for this to happen. I didn't wait the thread to be unlocked. I waited only for 2 hours and then I restarted the program for it to work.
I had a thought that the issue might appear due to internet connection instability but I tested out turning off internet and turning it in back and the reconnection was done without any troubles, so I believe it is not the case.
No, that's not supposed to happen. How long does it take for the thread to be locked?
I have added some descriptions above but I didn't measure in time after waiting for 2 hours.