Skip to content

Reset ThrottleHTTPStatusCode when throttle-http URL is cleared#21

Open
dnovitski wants to merge 1 commit into
masterfrom
fix/throttle-http-status-reset
Open

Reset ThrottleHTTPStatusCode when throttle-http URL is cleared#21
dnovitski wants to merge 1 commit into
masterfrom
fix/throttle-http-status-reset

Conversation

@dnovitski

@dnovitski dnovitski commented May 23, 2026

Copy link
Copy Markdown
Owner

Problem

When an operator changes or clears the throttle-http URL via interactive command, the HTTP polling stops (or switches endpoints) but the stale ThrottleHTTPStatusCode is 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

  1. Migration runs with --throttle-http=http://service/check
  2. Service returns 503 → ThrottleHTTPStatusCode stored as 503
  3. shouldThrottle() sees 503 != 0 && 503 != 200 → migration throttles ✅
  4. Operator clears URL: throttle-http= (to disable HTTP throttling)
  5. collectHTTPThrottleResponse sees empty URL → stops polling
  6. Bug: ThrottleHTTPStatusCode still holds 503
  7. shouldThrottle() keeps reading 503 → migration stays throttled forever ❌

Fix

Reset ThrottleHTTPStatusCode to 0 in SetThrottleHTTP() whenever the URL changes. 0 passes the statusCode != 0 guard in shouldThrottle(), 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)

@dnovitski dnovitski force-pushed the fix/throttle-http-status-reset branch from 418cdc5 to 0543f69 Compare May 24, 2026 02:39
Clear stale throttle HTTP status when the URL is removed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dnovitski dnovitski force-pushed the fix/throttle-http-status-reset branch from 0543f69 to d7f70fe Compare May 24, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant