Skip to content

feat: support for multiple Lavalink instances, with ping affinity support and load balancing#1795

Open
zapteryx wants to merge 6 commits into
nextfrom
feat/multiple-lavalink-instance-support
Open

feat: support for multiple Lavalink instances, with ping affinity support and load balancing#1795
zapteryx wants to merge 6 commits into
nextfrom
feat/multiple-lavalink-instance-support

Conversation

@zapteryx

Copy link
Copy Markdown
Member

Thank you for your interest in contributing!

Before proceeding, please review the guidelines for contributing.

  • Are you targeting the next branch? (left side)
  • Did you review the guidelines for contributing?
  • Does your code pass linting checks?
  • Is your code documented, if applicable? (Check if not applicable)
  • Does this PR have a linked issue?

Scope of change

  • Major change
  • Minor change
  • Documentation only

Type of change

  • Bug fix
  • Feature
  • Other

Priority

  • Critical
  • High
  • Medium
  • Low

Description

Please describe the changes.
Closes #1772

@zapteryx zapteryx added this to the Quaver 8 milestone Jun 18, 2026
@zapteryx
zapteryx requested a review from a team as a code owner June 18, 2026 07:03
@zapteryx zapteryx added the status:confirmed Issues and PRs: Confirmed bug, or enhancement is confirmed to be added label Jun 18, 2026
@zapteryx zapteryx linked an issue Jun 18, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@zapteryx, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 23 minutes and 45 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 395080b6-efce-46b2-9ba9-7fefd64ad900

📥 Commits

Reviewing files that changed from the base of the PR and between bb05202 and 9bfa018.

📒 Files selected for processing (12)
  • CONFIGURATION.md
  • src/commands/chatInputCommands/lyrics.ts
  • src/events/music/trackStart.ts
  • src/lib/QuaverClient.ts
  • src/lib/music/ClusterPlayerManager.ts
  • src/lib/music/ConnectionHealthMonitor.ts
  • src/lib/music/Penalties.ts
  • src/lib/music/QuaverCluster.ts
  • src/lib/music/QuaverPlayerManager.ts
  • src/lib/music/RegionAffinity.ts
  • src/lib/music/index.ts
  • src/schemas/Settings.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/multiple-lavalink-instance-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added priority:p2 Issues and PRs: Medium priority pr:type:feat PRs: Feature labels Jun 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces multi-node Lavalink support to Quaver, enabling intelligent load balancing, automatic failover, and region-based routing. It adds QuaverCluster to manage multiple nodes, ClusterPlayerManager to route player operations, and RegionAffinity to persist ping-based region latency data. Feedback on these changes highlights several critical issues: region-based routing is bypassed during player creation because the bot is not yet in the voice channel; selectNodeByAffinity lacks region filtering; region affinity data is keyed only by nodeId, causing different regions to overwrite each other; concurrent asynchronous pruning and cache refreshing can lead to race conditions; and guildNodeMap can retain stale mappings if players are destroyed directly on a node. Additionally, minor improvements were suggested to remove unused methods in RegionAffinity and optimize a loop in ClusterPlayerManager.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/lib/music/QuaverCluster.ts
Comment thread src/lib/music/ClusterPlayerManager.ts
Comment thread src/lib/music/RegionAffinity.ts Outdated
Comment thread src/lib/music/QuaverCluster.ts
Comment thread src/lib/music/ClusterPlayerManager.ts
Comment thread src/lib/music/ClusterPlayerManager.ts
Comment thread src/lib/music/RegionAffinity.ts Outdated
@zapteryx

Copy link
Copy Markdown
Member Author

@gemini-code-assist review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces multi-node Lavalink support to Quaver, enabling connections to multiple nodes for load balancing, automatic failover, and region-based routing. It adds QuaverCluster, ClusterPlayerManager, a penalty-based load balancing system, and persistent ping-based region affinity tracking. The review feedback highlights several critical improvements to enhance robustness and cross-platform compatibility. These include fixing a potential startup crash in the penalty calculation when node stats are missing, correcting the region affinity selection to filter by target region instead of averaging all pings, preventing a cache race condition in QuaverCluster, ensuring Windows compatibility for SQLite URIs, and adding defensive checks to avoid runtime errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/lib/music/Penalties.ts
Comment thread src/lib/music/QuaverCluster.ts
Comment thread src/lib/music/ClusterPlayerManager.ts
Comment thread src/lib/music/QuaverCluster.ts Outdated
Comment thread src/lib/music/RegionAffinity.ts Outdated
Comment thread src/lib/music/QuaverCluster.ts
Comment thread src/lib/QuaverClient.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:type:feat PRs: Feature priority:p2 Issues and PRs: Medium priority status:confirmed Issues and PRs: Confirmed bug, or enhancement is confirmed to be added

Development

Successfully merging this pull request may close these issues.

Support for multiple Lavalink instances

1 participant