Added an exit if the socket is closed for 10 min#101
Conversation
|
Hey @tacoroumen, Oh yeah.... Yeah, that should do it :) |
|
@tacoroumen I'm not familiar with this code, but if it's simple enough to detect and exit, could it attempt to reconnect instead? We could still exit if it couldn't reconnect after say 3 times. |
|
Hey @gabemeola I'm assuming it would already try and reconnect. But I'm not sure maybe @thomst08 knows this? If it doesn't reconnect after a disconnect we could also add this yes. |
This is a little tricky to know exactly.... Short answer is I don't know.
I like the idea and know where your coming from, but if D#+ crashes in the background, I haven't had success restarting the bot without closing the program and reopening it, even when rebuilding the bot without a restart, it seems to crash in the library in the backend and I couldn't find a way of reloading it. But this might be unrelated to this issue, just a note. @tacoroumen, you have got the check in the right spot, but I am unsure if that's what we want to look for, what happens when the bot crashes in other ways? Will it kill it when it's about to restart? I am not sure at the moment. But at a guess, it's a good idea and worth exploring. |
- Updated DSharpPlus packages
- Added waits to notification calls when sending messages on startup, this should help prevent the bot hitting rate limits
- Help prevent rate limits being hit at startup
|
Hey guys, I added some changes to the PR, basically some small waits on calls to Discord, just to help prevent rate limits. Was setup on PR #81, but only the waits without all the logging and other changes. I also push this into a docker container for testing, you can find the image here: |
|
Just testing the changes on my live system, these are the logs I am now getting. It looks like things are restarting every 1-2 hours....I wonder if for some reason, a reconnect isn't noted and it's resetting too often....will have to look into this before knowing if it is OK to pull in... |
- Added check for heartbeat and to restart based off that last connected time
- Small tweaks
|
I checked and tried to emulate a socket disconnect, I don't think there was a way to detect when a socket connection came back, so, if it failed once, it would restart in ten mins regardless it reconnected.... But I also found it does not handle when the heartbeat drops, so I added a check for that too and restarts when the heartbeat fails for 4 mins. This should help correct issues with internet dropouts. |
|
This is the log after running the bot for about 8 hours: The bot appears to drop the socket and then reconnect, the correction to the code seems to correct fix the issue with not noticing a reconnect on the socket. |
- Changed socket logs to debug
|
Happy with the changes made here, everything seems to be testing well. |
As per #99