From f34c0414019dfecf64905245573e5d8621b44e76 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 17 Feb 2024 02:39:42 -0500 Subject: [PATCH] fix: UploadExists/GetUpload needs ctx --- protocols/s5/s5.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocols/s5/s5.go b/protocols/s5/s5.go index 54a076f..c04d02f 100644 --- a/protocols/s5/s5.go +++ b/protocols/s5/s5.go @@ -227,18 +227,19 @@ type S5ProviderStore struct { } func (s S5ProviderStore) CanProvide(hash *encoding.Multihash, kind []types.StorageLocationType) bool { + ctx := context.Background() for _, t := range kind { switch t { case types.StorageLocationTypeArchive, types.StorageLocationTypeFile, types.StorageLocationTypeFull: rawHash := hash.HashBytes() - if exists, upload := s.tus.UploadExists(rawHash); exists { + if exists, upload := s.tus.UploadExists(ctx, rawHash); exists { if upload.Completed { 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 } }