fix: HealthChecker.Register immediately populates cache when already running#21979
Open
fix: HealthChecker.Register immediately populates cache when already running#21979
Conversation
Contributor
|
✅ No conflicts with other open PRs targeting |
fddfedc to
79ad808
Compare
|
79ad808 to
2de53c9
Compare
HealthChecker.Register() now signals the polling goroutine to run update() immediately when the checker is already running, eliminating the up-to-15-second window where a dynamically registered service (e.g. a spawned job) was absent from IsHealthy() / IsReady() even though Ready() already returned nil. Fixes CORE-2386. Companion chainlink-common PR: smartcontractkit/chainlink-common#1976
2de53c9 to
fc680d0
Compare
Contributor
|
I see you updated files related to
|
|
Updates chainlink-common to v0.11.2-0.20260410222629-07a72b48fc48 in core/scripts, deployment, integration-tests, integration-tests/load, system-tests/lib, and system-tests/tests sub-modules.
59cac3d to
7baf276
Compare
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
spawner.gostarts a job service and then registers it withHealthChecker. BecauseReady()reads state live butIsHealthy()returns a cached snapshot refreshed every 15 s, the new service appears absent from health reports for up to 15 seconds after it is already ready.HealthChecker.Register()inchainlink-commonnow immediately populatesc.ready/c.healthyfor the newly registered service when the checker is already running, so the stale-cache window is eliminated.servicesMuwrite lock is scoped to an inner closure and released before callingIfStarted, avoiding a potential deadlock withStart()(which holds theStateMachinelock while callingupdate(), which acquiresservicesMu.RLock).Changes
chainlink-common (companion branch:
fix/health-checker-register-immediate-update)pkg/services/health.go— modifiedRegister()to trigger an immediate single-service health check viaIfStartedpkg/services/health_test.go— two new tests: healthy and unhealthy service registered on a running checker are immediately visible without waiting for a tickchainlink (this PR)
go.mod/go.sum— bumpchainlink-commontov0.11.2-0.20260410211832-c51ec3e59945Test plan
go test github.com/smartcontractkit/chainlink-common/pkg/services/...— two new tests pass:TestHealthChecker_Register_ImmediateUpdate,TestHealthChecker_Register_ImmediateUpdate_Unhealthygo build ./core/services/...passes🤖 Generated with Claude Code