Skip to content

Commit

Permalink
Set readStartAtFile context aware for purge uploads (#4339)
Browse files Browse the repository at this point in the history
  • Loading branch information
milosgajdos committed May 2, 2024
2 parents c8e22f6 + f187586 commit cb3a201
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions registry/storage/purgeuploads.go
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit cb3a201

Please sign in to comment.