From f1875862cf98feeae883c7795d44d62f83a22e5a Mon Sep 17 00:00:00 2001 From: Sylvain DESGRAIS Date: Wed, 17 Jan 2024 13:42:52 +0100 Subject: [PATCH] Set readStartAtFile context aware for purge uploads Signed-off-by: Sylvain DESGRAIS --- registry/storage/purgeuploads.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/registry/storage/purgeuploads.go b/registry/storage/purgeuploads.go index e1a876e7..9e9407a1 100644 --- a/registry/storage/purgeuploads.go +++ b/registry/storage/purgeuploads.go @@ -93,7 +93,7 @@ func getOutstandingUploads(ctx context.Context, driver storageDriver.StorageDriv ud.containingDir = filePath } if file == "startedat" { - if t, err := readStartedAtFile(driver, filePath); err == nil { + if t, err := readStartedAtFile(ctx, driver, filePath); err == nil { ud.startedAt = t } else { errors = pushError(errors, filePath, err) @@ -124,9 +124,8 @@ func uuidFromPath(path string) (string, bool) { } // readStartedAtFile reads the date from an upload's startedAtFile -func readStartedAtFile(driver storageDriver.StorageDriver, path string) (time.Time, error) { - // todo:(richardscothern) - pass in a context - startedAtBytes, err := driver.GetContent(context.Background(), path) +func readStartedAtFile(ctx context.Context, driver storageDriver.StorageDriver, path string) (time.Time, error) { + startedAtBytes, err := driver.GetContent(ctx, path) if err != nil { return time.Now(), err }