Add join handle for StartDockerImageDownload to bound goroutine lifecycle - #47974
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
StartDockerImageDownload to bound goroutine lifecycle
There was a problem hiding this comment.
Pull request overview
Adds join handles to Docker image downloads for deterministic worker synchronization and cleanup.
Changes:
- Tracks per-image in-flight workers.
- Returns join functions from download starts.
- Adds join and cancellation tests.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/docker_images.go |
Adds worker tracking and join handles. |
pkg/cli/docker_images_test.go |
Updates and extends concurrency tests. |
pkg/cli/docker_images_test_helpers_test.go |
Resets in-flight test state. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Medium
| // Check if already available (inside lock for atomicity) | ||
| if isDockerImageAvailableUnlocked(ctx, image) { | ||
| dockerImagesLog.Printf("Image %s is already available", image) | ||
| return false | ||
| return false, func() {} |
There was a problem hiding this comment.
Fixed in e0c8d4e by checking downloading before image availability, so callers now keep observing the in-flight worker until its cleanup finishes.
| cancel() | ||
| joinFirst() | ||
| joinSecond() |
There was a problem hiding this comment.
Fixed in e0c8d4e by making joinSecond() run asynchronously, asserting it stays blocked while the shared worker is active, then canceling and verifying it completes.
|
@copilot run pr-finisher skill |
|
@copilot run pr-finisher skill |
|
@copilot please run the Unresolved review threads:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Ran the PR-finisher pass. Addressed the two open review threads in e0c8d4e and revalidated locally. |
Ran the PR-finisher pass on 1495b0c. The branch is up to date with
Ran the PR-finisher pass on 1495b0c. The branch is already up to date with |
|
🎉 This pull request is included in a new release. Release: |
StartDockerImageDownloadpreviously launched an unjoinable background goroutine, so callers had no way to observe completion and cleanup could run after caller scope moved on. This change introduces an explicit join point and tracks per-image in-flight workers to make lifecycle and state mutation bounded.Concurrency contract update
StartDockerImageDownloadsignature to return(started bool, join func()).join()blocks until the image’s background pull goroutine exits.Per-image in-flight join tracking
inflight map[string]chan struct{}alongsidedownloading.started=falseplus a join function for the existing worker.State cleanup hardening
downloading[image]andinflight[image]under lock.Call-site and behavior updates
Run: https://github.com/github/gh-aw/actions/runs/30156126450