fix: UploadExists/GetUpload needs ctx
This commit is contained in:
parent
a5f0a4bfcc
commit
f34c041401
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue