Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TgLongPoll locks the thread after working some time #258

Open
MrVolot opened this issue Jan 31, 2023 · 4 comments
Open

TgLongPoll locks the thread after working some time #258

MrVolot opened this issue Jan 31, 2023 · 4 comments

Comments

@MrVolot
Copy link

MrVolot commented Jan 31, 2023

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?

@llnulldisk
Copy link
Contributor

No, that's not supposed to happen. How long does it take for the thread to be locked?

@MrVolot
Copy link
Author

MrVolot commented Feb 5, 2023

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.

@MrVolot
Copy link
Author

MrVolot commented Feb 5, 2023

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.

@MrVolot
Copy link
Author

MrVolot commented Feb 5, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants