Beispiel #1
0
        public async Task IsAcquired_WhenLeaseWasReleasedNotAcquired_ReturnsTrue()
        {
            // arrange
            //
            var lease = await Lease.AcquireAsync(Blob, TimeSpan.FromMinutes(1));

            lease = await Lease.ReleaseAsync(Blob, lease);

            // act
            //
            lease = await Lease.AcquireAsync(Blob, TimeSpan.FromMinutes(1));

            // assert
            //
            Assert.True(Lease.IsAcquired(lease));
        }
Beispiel #2
0
        private async Task ReleaseLeaseAsync(Lease lease)
        {
            if (Lease.IsAcquired(lease))
            {
                try
                {
                    await Lease.ReleaseAsync(m_chaserExclusiveAccessBlobLock, lease);

                    s_logger.Verbose("Chaser lock was successfully released.");
                }
                catch (Exception exception)
                {
                    s_logger.Error(exception, "Releasing chaser lock failed.");
                }
            }
        }