コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        public static Task BreakLeaseAsync(this ICloudBlockBlob blob)
        {
            Require.NotNull(blob, "blob");

            return(blob.BreakLeaseAsync(null));
        }