Refactor polling services to use MultiConnectionPoller base class#13
Merged
Conversation
Extract common multi-connection polling logic into a reusable abstract base class. Both HealthService and PrometheusService now extend MultiConnectionPoller, which provides: - Standardized polling loop with start/stop lifecycle - Parallel polling of all connected database instances - Error isolation between connections - Automatic cleanup when connections are removed - Re-entrance guard to prevent overlapping poll cycles This reduces code duplication and ensures consistent polling behavior across services while preserving original functionality including the 5-second startup delay for health checks and webhook triggering after metrics collection.
Member
Author
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
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.
Extract common multi-connection polling logic into a reusable abstract base class. Both HealthService and PrometheusService now extend MultiConnectionPoller, which provides:
This reduces code duplication and ensures consistent polling behavior across services while preserving original functionality including the 5-second startup delay for health checks and webhook triggering after metrics collection.
Note
Medium Risk
Touches core periodic polling for health and metrics, so timing/coverage changes (especially polling disconnected connections and the new scheduler) could affect webhook firing and metric freshness if behavior diverges from the previous loops.
Overview
Refactors
HealthServiceandPrometheusServiceto extendMultiConnectionPoller, removing their bespoke timer loops and centralizing multi-connection scheduling, parallel per-connection execution, overlap-guarding, and removal cleanup.Adds
shouldPollDisconnected()to the base poller and enables it forHealthServiceso health checks run for disconnected connections too, while preserving the 5s startup delay before polling begins. Prometheus polling now runs per-connection viapollConnection()and folds storage-based metrics updates into the same per-connection path (including cleanup on connection removal), while keeping/metricsscrapes callingupdateMetrics()for connected connections.Written by Cursor Bugbot for commit 86e7992. This will update automatically on new commits. Configure here.