Repository navigation
Fix repeated Flush calls returning before uploads finish - #5
Open
agocharbhatia wants to merge 1 commit into
Open
agocharbhatia wants to merge 1 commit into
agocharbhatia wants to merge 1 commit into
Conversation
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
A repeated or overlapping
Flushcan return success while an earlier upload is still unacknowledged. This also happens when the first caller cancels its wait. The sender transfers its pending uploads to the first waiter and clears the list, so subsequent calls lose sight of that work.Change
Keep tracking unfinished uploads and copy the outstanding set for each flush waiter. This preserves the boundary between earlier and later work without changing upload concurrency, retries, queueing or
Close.Verification
An offline HTTP fixture holds the first upload open. The same tests fail on current main for overlapping and cancelled-first-call cases, then pass with this patch. A separate test ensures an earlier flush does not wait for later uploads.
go test -race -count=1 -v ./...passes locally, including the existing goroutine leak checks. Vet, build and formatting also pass on Go 1.25.4/macOS arm64. No live Better Stack endpoint or hosted CI result is claimed.