Skip to content

fix: interrupt retry waits when the request context ends - #543

Open
bensynapse wants to merge 1 commit into
imroc:masterfrom
bensynapse:fix-retry-context
Open

bensynapse wants to merge 1 commit into
imroc:masterfrom
bensynapse:fix-retry-context

Conversation

@bensynapse

Copy link
Copy Markdown

I run Live Tennis API.

Cancellation during a retry delay currently waits for the full interval. An expired request deadline also allows another retry.
Use the request context to interrupt the delay and return its error. Keep the last response body intact when the wait is interrupted.
The wait also respects a context replaced by a retry hook. Individual HTTP client timeouts still retry while the request context remains active.

The CI command, go test ./... -coverprofile=coverage.txt, passes on Go 1.25.14 and 1.26.3 in Docker.
All 354 tests and subtests pass. All 11 new cases pass 50 race repetitions. Ten fail on untouched master.
go build ./..., go vet ./..., and formatting pass.

Full race tests expose existing races in TestEnableDumpAll, TestEnableDump, and TestDumperAsync. Untouched master reproduces all three.

Stop a pending retry when the request is canceled or its deadline ends.
Keep the response and return the context error to the caller.
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