fix(metric): remove redundant timer cleanup code#7675
Merged
limingxinleo merged 2 commits intohyperf:masterfrom Jan 25, 2026
Merged
fix(metric): remove redundant timer cleanup code#7675limingxinleo merged 2 commits intohyperf:masterfrom
limingxinleo merged 2 commits intohyperf:masterfrom
Conversation
The Timer component now handles cleanup automatically on worker exit, so the manual timer cleanup logic in metric listeners is no longer needed. This removes the CoordinatorManager and Coroutine dependencies that were only used for timer cleanup. Changes: - Remove timerId variable assignment and cleanup coroutines - Remove unused imports: CoordinatorManager, Constants, and Coroutine - Simplify timer usage across all metric listeners Affected files: - MetricBufferWatcher - OnBeforeHandle - OnCoroutineServerStart - OnMetricFactoryReady - OnWorkerStart - PoolWatcher - QueueWatcher
There was a problem hiding this comment.
Pull request overview
This PR removes redundant timer cleanup code from metric listeners since the Timer component now handles cleanup automatically when workers exit via the coordinator pattern.
- Removes manual timer ID tracking and cleanup coroutines across all metric listeners
- Removes unused imports:
CoordinatorManager,Constants, andCoroutine - Simplifies timer usage by eliminating the need for explicit cleanup on worker exit
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/metric/src/Listener/QueueWatcher.php |
Removes timer cleanup coroutine and unused imports for queue metrics monitoring |
src/metric/src/Listener/PoolWatcher.php |
Removes timer cleanup coroutine and unused imports for connection pool monitoring |
src/metric/src/Listener/OnWorkerStart.php |
Removes timer cleanup coroutine and coordinator imports for worker-level metrics |
src/metric/src/Listener/OnMetricFactoryReady.php |
Removes timer cleanup coroutine and coordinator imports for metric factory readiness |
src/metric/src/Listener/OnCoroutineServerStart.php |
Removes timer cleanup coroutine and coordinator imports for coroutine server metrics |
src/metric/src/Listener/OnBeforeHandle.php |
Removes timer cleanup coroutine and coordinator imports for command metric collection |
src/metric/src/Listener/MetricBufferWatcher.php |
Removes timer cleanup coroutine and unused imports for metric buffer flushing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
limingxinleo
approved these changes
Jan 25, 2026
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.
Summary
Remove redundant timer cleanup code from metric listeners since the Timer component now handles cleanup automatically on worker exit.
Changes
Files Modified
src/metric/src/Listener/MetricBufferWatcher.phpsrc/metric/src/Listener/OnBeforeHandle.phpsrc/metric/src/Listener/OnCoroutineServerStart.phpsrc/metric/src/Listener/OnMetricFactoryReady.phpsrc/metric/src/Listener/OnWorkerStart.phpsrc/metric/src/Listener/PoolWatcher.phpsrc/metric/src/Listener/QueueWatcher.phpTest Plan
Breaking Changes
No breaking changes - this is an internal cleanup that removes redundant code.