Reset ThrottleHTTPStatusCode when throttle-http URL is cleared#21
Open
dnovitski wants to merge 1 commit into
Open
Reset ThrottleHTTPStatusCode when throttle-http URL is cleared#21dnovitski wants to merge 1 commit into
dnovitski wants to merge 1 commit into
Conversation
418cdc5 to
0543f69
Compare
Clear stale throttle HTTP status when the URL is removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0543f69 to
d7f70fe
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.
Problem
When an operator changes or clears the
throttle-httpURL via interactive command, the HTTP polling stops (or switches endpoints) but the staleThrottleHTTPStatusCodeis never reset. If the last HTTP response was non-200 (e.g. 503),shouldThrottle()keeps reading that code and the migration stays throttled forever with no way to unthrottle it.This also affects URL changes: switching from one endpoint to another carries over the old endpoint's status code, causing incorrect throttling until the new endpoint is polled.
Reproduction scenario
--throttle-http=http://service/checkThrottleHTTPStatusCodestored as503shouldThrottle()sees503 != 0 && 503 != 200→ migration throttles ✅throttle-http=(to disable HTTP throttling)collectHTTPThrottleResponsesees empty URL → stops pollingThrottleHTTPStatusCodestill holds503shouldThrottle()keeps reading503→ migration stays throttled forever ❌Fix
Reset
ThrottleHTTPStatusCodeto0inSetThrottleHTTP()whenever the URL changes.0passes thestatusCode != 0guard inshouldThrottle(), properly disabling HTTP throttling. When a new URL is set, the next poll will populate the correct status code from the new endpoint.Tests
TestSetThrottleHTTP_ClearsStatusCode: status code resets to 0 when URL is cleared (fails without fix:expected 0, got 503)TestSetThrottleHTTP_PreservesStatusCodeWhenURLSet: status code also resets when switching to a new URL (stale code from old endpoint is meaningless)