Repository navigation
[13.4-stable] zedUpload: let the caller inject the request's context - #117
Merged
milan-zededa merged 1 commit intoSep 29, 2026
Merged
Conversation
DronaRequest.WithCancel always derives a new cancellable context from the one it is given and keeps it in an unexported field, so a caller that has to wait on the same context the transfer runs under, for example while retrying a refused submission, had no way to get at it and ended up with two stacked contexts. DronaRequest.WithCancel is not needed anymore, so I removed it. Add WithContext, which stores the caller's context as it is, and have every transport run under that field, renamed from cancelContext to ctx since it no longer implies a cancel function of its own. This enables dependency injection of a context: the caller owns it, selects on its Done channel and cancels it, and the transport observes the same cancellation. WithCancel and Cancel keep working as before for callers that want the request to own the cancellation. Signed-off-by: Christoph Ostarek <christoph@zededa.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit a59ba20)
This was referenced Sep 28, 2026
milan-zededa
approved these changes
Sep 29, 2026
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.
Description
Backport of #113 to
13.4-stable,git cherry-pick -xwith one conflict, inzedUpload/datastore_http.goon the fourzedHttp.ExecCmd(...)calls: thisbranch passes neither the resumable-download parts nor the auth header that
main passes there. The resolution keeps the branch's calls as they are and
only renames
req.cancelContexttoreq.ctxin them, the same four one-wordchanges the commit makes on main. The S3, GCS and request files applied
cleanly. The four touched files are identical on
13.4-stableand14.5-stable, so this is the same resolution as #116.DronaRequest.WithCancelalways derived a new cancellable context from theone it was given and kept it in an unexported field, so a caller that has to
wait on the same context the transfer runs under, EVE's downloader while it
retries a submission the transport refused, had no way to get at it and ended
up with two stacked contexts. The commit replaces
WithCancelandCancelwith
WithContext, which stores the caller's context as it is, and has everytransport (HTTP, S3, GCS) run under that field, renamed from
cancelContextto
ctx. The caller owns the context, selects on itsDonechannel andcancels it, and the transport observes the same cancellation.
This is an API change for the library's consumer:
WithCancelandCancelare gone. EVE's
13.4-stabledownloader calls both, inpkg/pillar/cmd/downloader/download.go, so the eve-libs bump on EVE's13.4-stablehas to land together with the downloader change from thebackport of lf-edge/eve#6651, which switches it to
WithContext; the bumpcannot be taken on its own. EVE's
13.4-stablepins eve-libs atccb82e5 today, seven commits behind the current tip of this branch.
How to test and validate this PR
go build ./... && go vet ./... && go test ./zedUpload/: the change is afield rename, the removal of two methods and one new method; the existing
tests cover the transports' request handling. All three pass on this branch
locally, as does
golangci-lint run --new-from-rev=HEAD~1 ./zedUpload/...with no issues.
In EVE, after the bump, cancelling the downloader's request context must
still abort a running HTTP transfer and wake a submission waiting for room in
the transport queue.
PR Backports
Checklist
For backport PRs:
🤖 Generated with Claude Code