hutiefang76 opened a new pull request, #4169: URL: https://github.com/apache/hertzbeat/pull/4169
## What's changed? Fixes #4153. When the collector receives the same job id again, `TimerDispatcher` replaced the timeout stored in the task map but did not cancel the previous `HashedWheelTimer` timeout. The replaced timeout could stay active until it fired, so repeated job updates may accumulate unnecessary `HashedWheelTimeout` instances. This change cancels the previous timeout when a cyclic or temporary job is replaced by a new timeout for the same job id. It keeps the latest timeout in the map and only cancels the old one. Added regression coverage for both cyclic and temporary jobs to verify that: - the timeout map is updated to the new timeout - the old timeout is cancelled - the new timeout remains active Validation: - `git diff --check -- hertzbeat-collector/hertzbeat-collector-common/src/main/java/org/apache/hertzbeat/collector/timer/TimerDispatcher.java hertzbeat-collector/hertzbeat-collector-common/src/test/java/org/apache/hertzbeat/collector/timer/TimerDispatcherTest.java` - `./mvnw -pl hertzbeat-collector/hertzbeat-collector-common -am -Dsurefire.failIfNoSpecifiedTests=false test` ## Checklist - [x] I have read the [Contributing Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide) - [x] I have written the necessary doc or comment. - [x] I have added the necessary unit tests and all cases have passed. ## Add or update API No API is added or updated in this PR. - [ ] I have added the necessary [e2e tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have passed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
