fix package scripts, server join fallback logic, and reconnect timer leaks - #9
Open
Spagles wants to merge 3 commits into
Open
fix package scripts, server join fallback logic, and reconnect timer leaks#9Spagles wants to merge 3 commits into
Spagles wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
package.jsonentry points: Updatedmain,scripts.start, andscripts.devfrombot.jstobot-authme-first.js.bot.jsdidn't exist in the repository, so runningnpm startfailed immediately with aCannot find moduleerror.serverJoinedwas previously set totrueimmediately when sending the/server survivalcommand. Because it was set totrueright away, the 10-second timeout conditionif (authmeCompleted && !serverJoined)could never evaluate to true. If a server didn't send a chat message matching the expected join keywords, the fallback would never trigger and the bot would get stuck in the lobby without starting AFK tasks. We now only setserverJoined = trueonce chat confirms the join or when the 10-second fallback timer elapses.'kicked'and'end'events. Because both handlers scheduledcreateBot()after a delay, every kick spawned two bots connecting simultaneously with the same username, triggering an infinite reconnect/kick loop. Reconnects are now debounced with a single timeout guard (scheduleReconnect).startAntiAFK()andstartChatMessages()created newsetIntervaltimers on every call without clearing existing ones. Over multiple reconnections or deaths, these timers accumulated in the event loop and performed duplicate actions against the bot instance. Interval handles are now stored and cleared properly before creating new loops and on graceful shutdown (SIGINT/SIGTERM).