I have a case that sometimes CloudBlockBlob.StartCopyAsync
writes only 0 bytes data into the input asset's blob... What should be the case? So, I decided to start copy while block blob length will not be increased... Any suggestions?
private async Task CreateInputAssetBlobAsync(UploadRequest request)
{
var cloudBlobContainer = new CloudBlobContainer(request.InputAssetStorageUri);
var blockBlob = cloudBlobContainer.GetBlockBlobReference(request.BlobName);
var storageCredentials = new Microsoft.Azure.Storage.Auth.StorageCredentials(_apiAccess.TempBlobAccountName, _apiAccess.TempBlobContainerKey);
var tempBlobContainer = new CloudBlobContainer(new Uri(_apiAccess.TempBlobContainerAddress), storageCredentials);
var tempBlockBlob = tempBlobContainer.GetBlockBlobReference(request.BlobName);
try
{
await blockBlob.StartCopyAsync(tempBlockBlob);
do
{
if (blockBlob.CopyState.Status == CopyStatus.Pending)
await Task.Delay(1000);
await blockBlob.FetchAttributesAsync();
}
while (blockBlob.CopyState.Status != CopyStatus.Success);
return;
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}