Why does it take 100 seconds to delete a blob?

208 Views Asked by At

I have code like this

BlobDownloadInfo blob = Client.GetBlockBlobClient(filePath).Download().Value;
...
Client.GetBlockBlobClient(filePath).DeleteIfExists();

And DeleteIfExists() reliably takes 00:01:42 (about 100 seconds) to delete my blob. Why?

1

There are 1 best solutions below

0
On BEST ANSWER

BlobDownloadInfo is an IDisposable. By not disposing it, we appear to be keeping open the connection and forcing DeleteIfExists() to wait for that connection to timeout. Updating the code to

using (BlobDownloadInfo blob = Client.GetBlockBlobClient(filePath).Download().Value)

causes DeleteIfExists() to return in about 00:00:00.15