From 4743c7ba0d93de02727daf41e866a385fa07bcc3 Mon Sep 17 00:00:00 2001 From: Mark Feit Date: Fri, 17 Dec 2021 10:09:36 -0500 Subject: [PATCH] DOn't cancel the context and use a sane deadline. --- src/duplicacy_swiftstorage.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/duplicacy_swiftstorage.go b/src/duplicacy_swiftstorage.go index 8ed7947b..f4dfcae8 100644 --- a/src/duplicacy_swiftstorage.go +++ b/src/duplicacy_swiftstorage.go @@ -108,9 +108,7 @@ func CreateSwiftStorage(storageURL string, key string, threads int) (storage *Sw arguments["protocol"] = "https" } - // This context ends up expired, which is fine. - ctx, cancel := context.WithDeadline(context.Background(), time.Now()) - defer cancel() + ctx, _ := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second) // Please refer to https://godoc.org/github.com/ncw/swift#Connection connection := swift.Connection{