Skip to content

Add functionality to nodes to transfer all players to other nodes. #35

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

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

kikkia
Copy link
Contributor

@kikkia kikkia commented Mar 7, 2025

I was messing around with the new reconnect functionality and was toying with exposing the transferNode function. This allowed for transferring players between nodes. Which can be useful when updating nodes requires a restart of the node. I have a decent sized fleet of nodes and this would be helpful and allow for a much more seamless rollout of updates to my nodes. Allowing users of the client to transfer players away from nodes before rebooting without just killing those players.

One issue I did hit was that the disconnect codes from the node when transferring (and thus disconnecting) would remove the link from cache. We want to preserve that link so I added a state to the node object that prevents the node disconnect codes from removing the transferring links from the cache. This state is removed on a reconnect or manually if desired.

It may make some sense to add some enum states like the links have with CONNECTED/DISCONNECTED, etc to the node. However, that could be also a bit iffy as a node could be transferring and still connected. So for this change I though the scope or broader implications might be better for a follow through.

Changes

  • Allowing transferNode fun to be called from internal classes.
  • Add transferPlayersToOtherNodes() to the node class that starts a transfer of all players from that node to others.
  • Add a transferring state to the node that prevents disconnect events for the node to remove links from the cache.

Copy link
Collaborator

@duncte123 duncte123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@duncte123 duncte123 merged commit 492c23a into lavalink-devs:main Mar 10, 2025
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants