From 8b8220c4f7a596ddb244d576af7821d7d2828437 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 24 Nov 2018 10:53:44 +0000 Subject: [PATCH] azureblob: wait for up to 60s to create a just deleted container When a container is deleted, a container with the same name cannot be created for at least 30 seconds; the container may not be available for more than 30 seconds if the service is still processing the request. We sleep so that we wait at most 60 seconds. This is mostly useful in the integration tests where containers get deleted and remade immediately. --- backend/azureblob/azureblob.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index 55e1517c7..28d6d6ff1 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -706,6 +706,11 @@ func (f *Fs) Mkdir(dir string) error { f.containerOK = true return false, nil case azblob.ServiceCodeContainerBeingDeleted: + // From https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container + // When a container is deleted, a container with the same name cannot be created + // for at least 30 seconds; the container may not be available for more than 30 + // seconds if the service is still processing the request. + time.Sleep(6 * time.Second) // default 10 retries will be 60 seconds f.containerDeleted = true return true, err }