perf(queue): skip unused server status checks - #246
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe 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. ChangesOnline server check selection
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
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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.
| 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); |
Summary
Production behavior
The current 6b6t production proxy configuration has both
pauseQueueIfTargetDownandkickWhenDowndisabled. With this change, its computed server check set is empty, so PistonQueue will stop pingingmain-serverandbackup-serverentirely.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