fix: UploadExists/GetUpload needs ctx

This commit is contained in:
Derrick Hammer 2024-02-17 02:39:42 -05:00
parent a5f0a4bfcc
commit f34c041401
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 2 deletions

View File

@ -227,18 +227,19 @@ type S5ProviderStore struct {
} }
func (s S5ProviderStore) CanProvide(hash *encoding.Multihash, kind []types.StorageLocationType) bool { func (s S5ProviderStore) CanProvide(hash *encoding.Multihash, kind []types.StorageLocationType) bool {
ctx := context.Background()
for _, t := range kind { for _, t := range kind {
switch t { switch t {
case types.StorageLocationTypeArchive, types.StorageLocationTypeFile, types.StorageLocationTypeFull: case types.StorageLocationTypeArchive, types.StorageLocationTypeFile, types.StorageLocationTypeFull:
rawHash := hash.HashBytes() rawHash := hash.HashBytes()
if exists, upload := s.tus.UploadExists(rawHash); exists { if exists, upload := s.tus.UploadExists(ctx, rawHash); exists {
if upload.Completed { if upload.Completed {
return true return true
} }
} }
if _, err := s.metadata.GetUpload(context.Background(), rawHash); errors.Is(err, metadata.ErrNotFound) { if _, err := s.metadata.GetUpload(ctx, rawHash); errors.Is(err, metadata.ErrNotFound) {
return true return true
} }
} }