Esempio n. 1
0
        public async Task CanRenew()
        {
            var m     = new DynamoDBMutex(RegionEndpoint.EUWest1);
            var resId = Guid.NewGuid().ToString("N");
            var t     = await m.AcquireLockAsync(resId, TimeSpan.FromSeconds(10));

            var t2 = await m.RenewAsync(t, TimeSpan.FromSeconds(20));

            Assert.NotNull(t2);
        }
Esempio n. 2
0
        public async Task CanNotRenewIfSomeoneElse()
        {
            var m     = new DynamoDBMutex(RegionEndpoint.EUWest1);
            var resId = Guid.NewGuid().ToString("N");
            var t     = await m.AcquireLockAsync(resId, TimeSpan.FromSeconds(10));

            var other = new LockToken(t.ResourceId, "other", t.LeaseExpiry);
            var t2    = await m.RenewAsync(other, TimeSpan.FromSeconds(20));

            Assert.Null(t2);
        }