diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e4a7b9..ff2ddd3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#460](https://github.com/spegel-org/spegel/pull/460) Fix environment variable for http-bootstrap-addr flag. - [#471](https://github.com/spegel-org/spegel/pull/471) Fix handler key in request logging. +- [#491](https://github.com/spegel-org/spegel/pull/491) Fix so that resolve timeout does not cancel mirroring attempts. ### Security diff --git a/pkg/registry/registry.go b/pkg/registry/registry.go index 329822bb..0114d841 100644 --- a/pkg/registry/registry.go +++ b/pkg/registry/registry.go @@ -246,8 +246,7 @@ func (r *Registry) handleMirror(rw mux.ResponseWriter, req *http.Request, ref re mirrorAttempts := 0 for { select { - // TODO: Refactor context cancel and mirror channel closing - case <-resolveCtx.Done(): + case <-req.Context().Done(): // Request has been closed by server or client. No use continuing. rw.WriteError(http.StatusNotFound, fmt.Errorf("mirroring for image component %s has been cancelled: %w", key, resolveCtx.Err())) return