Skip to content

perf(queue): skip unused server status checks - #246

Merged
AlexProgrammerDE merged 1 commit into
mainfrom
feat/disable-server-online-checks
Aug 10, 2026
Merged

perf(queue): skip unused server status checks#246
AlexProgrammerDE merged 1 commit into
mainfrom
feat/disable-server-online-checks

Conversation

@AlexProgrammerDE

@AlexProgrammerDE AlexProgrammerDE commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • derive server checks from the availability features that are actually enabled
  • stop position messages from depending on target status when queue pausing is disabled
  • clear stale status entries after a live configuration reload
  • compile the Velocity 4 and universal modules with their required Java 25 toolchain

Production behavior

The current 6b6t production proxy configuration has both pauseQueueIfTargetDown and kickWhenDown disabled. With this change, its computed server check set is empty, so PistonQueue will stop pinging main-server and backup-server entirely.

If either feature is enabled later, PistonQueue automatically checks only the servers that feature needs. No configuration migration or new option is required.

Testing

  • ./gradlew spotlessApply build
  • 113 shared tests pass, including new coverage for disabled checks, each availability feature, and stale status cleanup
  • the complete multi-platform build passes

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b3bceaa-709c-4f31-ada3-499d0b9ae221

📥 Commits

Reviewing files that changed from the base of the PR and between 90dd479 and b870865.

📒 Files selected for processing (5)
  • shared/src/main/java/net/pistonmaster/pistonqueue/shared/config/Config.java
  • shared/src/main/java/net/pistonmaster/pistonqueue/shared/plugin/PistonQueuePlugin.java
  • shared/src/main/java/net/pistonmaster/pistonqueue/shared/queue/ServerStatusManager.java
  • shared/src/test/java/net/pistonmaster/pistonqueue/shared/config/ConfigTest.java
  • shared/src/test/java/net/pistonmaster/pistonqueue/shared/queue/logic/ServerStatusManagerTest.java

📝 Walkthrough

Walkthrough

The change derives monitored servers from enabled availability-dependent features. Queue activity no longer depends on target availability when pausing is disabled. Unneeded server status data is removed before checks are scheduled.

Changes

Online server check selection

Layer / File(s) Summary
Required server set contract
shared/src/main/java/net/pistonmaster/pistonqueue/shared/config/Config.java, shared/src/test/java/net/pistonmaster/pistonqueue/shared/config/ConfigTest.java
serversRequiringOnlineChecks() combines enabled queue target servers and kick-when-down servers, removes duplicates, and returns an unmodifiable set. Tests cover empty, queue-pausing, and kick-server configurations.
Status retention
shared/src/main/java/net/pistonmaster/pistonqueue/shared/queue/ServerStatusManager.java, shared/src/test/java/net/pistonmaster/pistonqueue/shared/queue/logic/ServerStatusManagerTest.java
retainServers removes ping-count data for servers that no longer require checks. Tests verify retained and removed server status.
Scheduling integration
shared/src/main/java/net/pistonmaster/pistonqueue/shared/plugin/PistonQueuePlugin.java
Queue activity remains enabled when target pausing is disabled. Monitoring retains only configured servers and skips scheduling when no servers require checks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Config
  participant PistonQueuePlugin
  participant ServerStatusManager
  Config->>PistonQueuePlugin: provide serversRequiringOnlineChecks
  PistonQueuePlugin->>ServerStatusManager: retainServers(required servers)
  PistonQueuePlugin->>ServerStatusManager: schedule checks for required servers
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/disable-server-online-checks

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.

@AlexProgrammerDE
AlexProgrammerDE marked this pull request as ready for review August 10, 2026 14:08
Copilot AI lite review requested due to automatic review settings August 10, 2026 14:08
@AlexProgrammerDE
AlexProgrammerDE merged commit 4b95d72 into main Aug 10, 2026
2 of 4 checks passed

Copilot AI 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.

Pull request overview

This PR reduces unnecessary server status polling by computing the set of servers that actually need online checks based on which availability features are enabled, and ensures stale server-status entries are cleared when checks are no longer needed.

Changes:

  • Add Config.serversRequiringOnlineChecks() to derive the exact server set needed for availability features.
  • Update scheduled tasks to skip status checks entirely when no feature needs them, and to stop position messages from depending on target status when queue pausing is disabled.
  • Add ServerStatusManager.retainServers(...) plus tests covering disabled checks and stale status cleanup.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
shared/src/main/java/net/pistonmaster/pistonqueue/shared/config/Config.java Introduces derived server set for online checks based on enabled features.
shared/src/main/java/net/pistonmaster/pistonqueue/shared/plugin/PistonQueuePlugin.java Uses the derived server set to skip unnecessary checks and avoid gating position messages when pausing is off.
shared/src/main/java/net/pistonmaster/pistonqueue/shared/queue/ServerStatusManager.java Adds ability to remove stale status entries for servers no longer checked.
shared/src/test/java/net/pistonmaster/pistonqueue/shared/config/ConfigTest.java Adds unit coverage for derived server-check set behavior under different feature toggles.
shared/src/test/java/net/pistonmaster/pistonqueue/shared/queue/logic/ServerStatusManagerTest.java Adds unit coverage for stale status removal via retainServers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 73 to +77
final QueueGroup defaultGroup = config.getDefaultGroup();
// Sends the position message and updates tab on an interval in chat
schedule(() -> {
boolean targetsOnline = defaultGroup.targetServers().stream().anyMatch(queueListener.getServerStatusManager().getOnlineServers()::contains);
boolean targetsOnline = !config.pauseQueueIfTargetDown()
|| defaultGroup.targetServers().stream().anyMatch(queueListener.getServerStatusManager().getOnlineServers()::contains);
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