You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Try to acquire a lease on the blob. If the acquire is successful the lease will be renewed at every 60 seconds.
33
-
/// In order to stop the renew task the <see cref="Stats.AzureCdnLogs.Common.AzureBlobLeaseManager.TryReleaseLease(CloudBlob)"/> needs to be invoked
35
+
/// In order to stop the renew task the <see cref="Stats.AzureCdnLogs.Common.AzureBlobLeaseManager.TryReleaseLockAsync(AzureBlobLockResult)"/> needs to be invoked
34
36
/// or the token to be cancelled.
35
37
/// </summary>
36
38
/// <param name="blob">The blob to acquire the lease on.</param>
37
-
/// <param name="token">A token to cancel the operation.</param>
_logger.LogInformation("AcquireLease: The operation was cancelled or the blob lease is already taken. Blob {BlobUri}, Cancellation status {IsCancellationRequested}, BlobLeaseStatus {BlobLeaseStatus}.",
_logger.LogWarning(LogEvents.FailedBlobLease,exception,"RenewLeaseTask: The Lease could not be renewed for BlobUri {BlobUri}. ExpectedLeaseId {LeaseId}. CurrentLeaseId {CurrentLeaseId}.",
89
-
blob.Uri.AbsoluteUri,
90
-
leaseId,
91
-
blobLockResult.LeaseId);
92
-
blobLockResult.BlobOperationToken.Cancel();
93
64
break;
94
65
}
66
+
awaitleaseClient.RenewAsync();
67
+
_logger.LogInformation("RenewLeaseTask: Lease was renewed for BlobUri {BlobUri} and LeaseId {LeaseId}.",
68
+
blob.Uri.AbsoluteUri,
69
+
leaseId);
70
+
}
71
+
catch(Exceptionex)
72
+
{
73
+
_logger.LogWarning(ex,"RenewLeaseTask: The Lease could not be renewed for BlobUri {BlobUri}. LeaseId {LeaseId}.",
74
+
blob.Uri.AbsoluteUri,
75
+
leaseId);
76
+
lockResult.BlobOperationToken.Cancel();
77
+
break;
95
78
}
96
79
}
97
-
},lockResult,TaskCreationOptions.LongRunning);
98
-
renewStatusTask.Start();
99
-
returnlockResult;
80
+
81
+
82
+
83
+
},lockResult.BlobOperationToken.Token);
84
+
returnlockResult;
85
+
}
86
+
catch(Exceptionex)
87
+
{
88
+
_logger.LogError(ex,"AcquireLeaseAsync: Failed to acquire lease for BlobUri {BlobUri}.",blob.Uri.AbsoluteUri);
0 commit comments