public async Task MarkCompletedAsync(IStorageBlockBlob blob, string leaseId, CancellationToken cancellationToken) { BlobReceipt.Complete.ToMetadata(blob.Metadata); try { await blob.SetMetadataAsync( accessCondition : new AccessCondition { LeaseId = leaseId }, options : null, operationContext : null, cancellationToken : cancellationToken); } catch (StorageException exception) { if (exception.IsNotFoundBlobOrContainerNotFound()) { // The user deleted the receipt or its container; nothing to mark complete at this point. } else if (exception.IsPreconditionFailedLeaseLost()) { // The lease expired; don't try to mark complete at this point. } else { throw; } } }
private async Task WriteLeaseBlobMetadata(IStorageBlockBlob blob, string leaseId, string functionInstanceId, CancellationToken cancellationToken) { blob.Metadata.Add(FunctionInstanceMetadataKey, functionInstanceId); try { await blob.SetMetadataAsync( accessCondition : new AccessCondition { LeaseId = leaseId }, options : null, operationContext : null, cancellationToken : cancellationToken); } catch (StorageException exception) { if (exception.IsNotFoundBlobOrContainerNotFound()) { // The user deleted the receipt or its container; } else if (exception.IsPreconditionFailedLeaseLost()) { // The lease expired; } else { throw; } } }
private async Task WriteLeaseBlobMetadata(IStorageBlockBlob blob, string leaseId, string functionInstanceId, CancellationToken cancellationToken) { blob.Metadata.Add(FunctionInstanceMetadataKey, functionInstanceId); await blob.SetMetadataAsync( accessCondition : new AccessCondition { LeaseId = leaseId }, options : null, operationContext : null, cancellationToken : cancellationToken); }
private async Task WriteLeaseBlobMetadata(IStorageBlockBlob blob, string leaseId, string functionInstanceId, CancellationToken cancellationToken) { blob.Metadata.Add(FunctionInstanceMetadataKey, functionInstanceId); try { await blob.SetMetadataAsync( accessCondition: new AccessCondition { LeaseId = leaseId }, options: null, operationContext: null, cancellationToken: cancellationToken); } catch (StorageException exception) { if (exception.IsNotFoundBlobOrContainerNotFound()) { // The user deleted the receipt or its container; } else if (exception.IsPreconditionFailedLeaseLost()) { // The lease expired; } else { throw; } } }
private async Task WriteLeaseBlobMetadata(IStorageBlockBlob blob, string leaseId, string functionInstanceId, CancellationToken cancellationToken) { blob.Metadata.Add(FunctionInstanceMetadataKey, functionInstanceId); await blob.SetMetadataAsync( accessCondition: new AccessCondition { LeaseId = leaseId }, options: null, operationContext: null, cancellationToken: cancellationToken); }
public async Task MarkCompletedAsync(IStorageBlockBlob blob, string leaseId, CancellationToken cancellationToken) { BlobReceipt.Complete.ToMetadata(blob.Metadata); try { await blob.SetMetadataAsync( accessCondition: new AccessCondition { LeaseId = leaseId }, options: null, operationContext: null, cancellationToken: cancellationToken); } catch (StorageException exception) { if (exception.IsNotFoundBlobOrContainerNotFound()) { // The user deleted the receipt or its container; nothing to mark complete at this point. } else if (exception.IsPreconditionFailedLeaseLost()) { // The lease expired; don't try to mark complete at this point. } else { throw; } } }