private async Task BreakLeasIfExpiredAsync() { await m_blob.FetchAttributesAsync(); if (m_blob.Metadata.ContainsKey(Constants.MetadataProperties.SESSION_EXPIRES_ON)) { var expiresOn = DateTimeOffset.Parse(m_blob.Metadata[Constants.MetadataProperties.SESSION_EXPIRES_ON]); if (expiresOn <= DateTimeOffset.UtcNow) { await m_blob.BreakLeaseAsync(); s_logger.Warning("Acquired session's ({StreamName}, {ConsumerId}) lease has been broken.", m_streamName, m_acquiredLease); } } }
public static Task BreakLeaseAsync(this ICloudBlockBlob blob) { Require.NotNull(blob, "blob"); return(blob.BreakLeaseAsync(null)); }