forked from TrueCloudLab/distribution
Set readStartAtFile context aware for purge uploads
Signed-off-by: Sylvain DESGRAIS <sylvain.desgrais@gmail.com>
This commit is contained in:
parent
c8e22f6723
commit
f1875862cf
1 changed files with 3 additions and 4 deletions
|
@ -93,7 +93,7 @@ func getOutstandingUploads(ctx context.Context, driver storageDriver.StorageDriv
|
||||||
ud.containingDir = filePath
|
ud.containingDir = filePath
|
||||||
}
|
}
|
||||||
if file == "startedat" {
|
if file == "startedat" {
|
||||||
if t, err := readStartedAtFile(driver, filePath); err == nil {
|
if t, err := readStartedAtFile(ctx, driver, filePath); err == nil {
|
||||||
ud.startedAt = t
|
ud.startedAt = t
|
||||||
} else {
|
} else {
|
||||||
errors = pushError(errors, filePath, err)
|
errors = pushError(errors, filePath, err)
|
||||||
|
@ -124,9 +124,8 @@ func uuidFromPath(path string) (string, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// readStartedAtFile reads the date from an upload's startedAtFile
|
// readStartedAtFile reads the date from an upload's startedAtFile
|
||||||
func readStartedAtFile(driver storageDriver.StorageDriver, path string) (time.Time, error) {
|
func readStartedAtFile(ctx context.Context, driver storageDriver.StorageDriver, path string) (time.Time, error) {
|
||||||
// todo:(richardscothern) - pass in a context
|
startedAtBytes, err := driver.GetContent(ctx, path)
|
||||||
startedAtBytes, err := driver.GetContent(context.Background(), path)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return time.Now(), err
|
return time.Now(), err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue