diff --git a/RedLock.StrongName.nuspec b/RedLock.StrongName.nuspec index f85da47..897c9d0 100644 --- a/RedLock.StrongName.nuspec +++ b/RedLock.StrongName.nuspec @@ -2,7 +2,7 @@ RedLock.net.StrongName - 2.0.0-pre3 + 2.0.0 RedLock.net (Strong Named) Sam Cook Sam Cook @@ -11,8 +11,8 @@ https://raw.githubusercontent.com/samcook/RedLock.net/master/redlock-icon.png false An implementation of the Redlock distributed lock algorithm - 2.0.0-pre3 - .NET Core release - Copyright 2017 Sam Cook + 2.0.0 - .NET Core release + Copyright 2018 Sam Cook RedLock Redis Distributed Lock diff --git a/RedLock.nuspec b/RedLock.nuspec index 249932a..31733e8 100644 --- a/RedLock.nuspec +++ b/RedLock.nuspec @@ -2,7 +2,7 @@ RedLock.net - 2.0.0-pre3 + 2.0.0 RedLock.net Sam Cook Sam Cook @@ -11,8 +11,8 @@ https://raw.githubusercontent.com/samcook/RedLock.net/master/redlock-icon.png false An implementation of the Redlock distributed lock algorithm - 2.0.0-pre3 - .NET Core release - Copyright 2017 Sam Cook + 2.0.0 - .NET Core release + Copyright 2018 Sam Cook RedLock Redis Distributed Lock diff --git a/RedLockNet.Abstractions.StrongName/RedLockNet.Abstractions.StrongName.csproj b/RedLockNet.Abstractions.StrongName/RedLockNet.Abstractions.StrongName.csproj index c874317..b85e185 100644 --- a/RedLockNet.Abstractions.StrongName/RedLockNet.Abstractions.StrongName.csproj +++ b/RedLockNet.Abstractions.StrongName/RedLockNet.Abstractions.StrongName.csproj @@ -4,20 +4,20 @@ netstandard1.1 RedLockNet False - 2.0.0-pre3 + 2.0.0 Sam Cook RedLock.net Abstractions for the RedLock.net package RedLock.net.Abstractions - Copyright 2017 Sam Cook + Copyright 2018 Sam Cook https://github.com/samcook/RedLock.net/blob/master/LICENSE https://github.com/samcook/RedLock.net https://github.com/samcook/RedLock.net https://raw.githubusercontent.com/samcook/RedLock.net/master/redlock-icon.png git RedLock Redis Distributed Lock - 2.0.0-pre3 - .NET Core release + 2.0.0 - .NET Core release RedLockNet.Abstractions.StrongName True ..\RedLock.StrongName.snk diff --git a/RedLockNet.Abstractions/RedLockNet.Abstractions.csproj b/RedLockNet.Abstractions/RedLockNet.Abstractions.csproj index bc55686..405fbf2 100644 --- a/RedLockNet.Abstractions/RedLockNet.Abstractions.csproj +++ b/RedLockNet.Abstractions/RedLockNet.Abstractions.csproj @@ -4,20 +4,20 @@ netstandard1.1 RedLockNet False - 2.0.0-pre3 + 2.0.0 Sam Cook RedLock.net Abstractions for the RedLock.net package RedLock.net.Abstractions - Copyright 2017 Sam Cook + Copyright 2018 Sam Cook https://github.com/samcook/RedLock.net/blob/master/LICENSE https://github.com/samcook/RedLock.net https://github.com/samcook/RedLock.net https://raw.githubusercontent.com/samcook/RedLock.net/master/redlock-icon.png git RedLock Redis Distributed Lock - 2.0.0-pre3 - .NET Core release + 2.0.0 - .NET Core release RedLockNet.Abstractions diff --git a/RedLockNet.SERedis.Shared/RedLock.cs b/RedLockNet.SERedis.Shared/RedLock.cs index 8da7896..3fe1d81 100644 --- a/RedLockNet.SERedis.Shared/RedLock.cs +++ b/RedLockNet.SERedis.Shared/RedLock.cs @@ -206,11 +206,11 @@ private async Task StartAsync() var iteration = i + 1; logger.LogDebug($"Lock attempt {iteration}/{quorumRetryCount}: {Resource} ({LockId}), expiry: {expiryTime}"); - var startTick = Stopwatch.GetTimestamp(); + var stopwatch = Stopwatch.StartNew(); lockSummary = Lock(); - var validityTicks = GetRemainingValidityTicks(startTick); + var validityTicks = GetRemainingValidityTicks(stopwatch); logger.LogDebug($"Acquired locks for {Resource} ({LockId}) in {lockSummary.Acquired}/{redisCaches.Count} instances, quorum: {quorum}, validityTicks: {validityTicks}"); @@ -252,11 +252,11 @@ private async Task StartAsync() var iteration = i + 1; logger.LogDebug($"Lock attempt {iteration}/{quorumRetryCount}: {Resource} ({LockId}), expiry: {expiryTime}"); - var startTick = Stopwatch.GetTimestamp(); + var stopwatch = Stopwatch.StartNew(); lockSummary = await LockAsync().ConfigureAwait(false); - var validityTicks = GetRemainingValidityTicks(startTick); + var validityTicks = GetRemainingValidityTicks(stopwatch); logger.LogDebug($"Acquired locks for {Resource} ({LockId}) in {lockSummary.Acquired}/{redisCaches.Count} instances, quorum: {quorum}, validityTicks: {validityTicks}"); @@ -300,11 +300,11 @@ private void StartAutoExtendTimer() { logger.LogTrace($"Lock renewal timer fired: {Resource} ({LockId})"); - var startTick = Stopwatch.GetTimestamp(); + var stopwatch = Stopwatch.StartNew(); var extendSummary = Extend(); - var validityTicks = GetRemainingValidityTicks(startTick); + var validityTicks = GetRemainingValidityTicks(stopwatch); if (extendSummary.Acquired >= quorum && validityTicks > 0) { @@ -334,12 +334,12 @@ private void StartAutoExtendTimer() (int) interval); } - private long GetRemainingValidityTicks(long startTick) + private long GetRemainingValidityTicks(Stopwatch sw) { // Add 2 milliseconds to the drift to account for Redis expires precision, // which is 1 milliescond, plus 1 millisecond min drift for small TTLs. var driftTicks = (long) (expiryTime.Ticks * clockDriftFactor) + TimeSpan.FromMilliseconds(2).Ticks; - var validityTicks = expiryTime.Ticks - (Stopwatch.GetTimestamp() - startTick) - driftTicks; + var validityTicks = expiryTime.Ticks - sw.Elapsed.Ticks - driftTicks; return validityTicks; } diff --git a/RedLockNet.SERedis.StrongName/RedLockNet.SERedis.StrongName.csproj b/RedLockNet.SERedis.StrongName/RedLockNet.SERedis.StrongName.csproj index 15778e4..2d86d55 100644 --- a/RedLockNet.SERedis.StrongName/RedLockNet.SERedis.StrongName.csproj +++ b/RedLockNet.SERedis.StrongName/RedLockNet.SERedis.StrongName.csproj @@ -5,19 +5,19 @@ RedLockNet.SERedis.StrongName RedLock.net RedLockNet.SERedis - 2.0.0-pre3 + 2.0.0 An implementation of the Redlock distributed lock algorithm Sam Cook RedLock.net - Copyright 2017 Sam Cook + Copyright 2018 Sam Cook https://github.com/samcook/RedLock.net/blob/master/LICENSE https://github.com/samcook/RedLock.net https://raw.githubusercontent.com/samcook/RedLock.net/master/redlock-icon.png https://github.com/samcook/RedLock.net git RedLock Redis Distributed Lock - 2.0.0-pre3 - .NET Core release + 2.0.0 - .NET Core release False True ..\RedLock.StrongName.snk diff --git a/RedLockNet.SERedis/RedLockNet.SERedis.csproj b/RedLockNet.SERedis/RedLockNet.SERedis.csproj index 081bce7..ab07cdc 100644 --- a/RedLockNet.SERedis/RedLockNet.SERedis.csproj +++ b/RedLockNet.SERedis/RedLockNet.SERedis.csproj @@ -5,19 +5,19 @@ RedLockNet.SERedis RedLock.net RedLockNet.SERedis - 2.0.0-pre3 + 2.0.0 An implementation of the Redlock distributed lock algorithm Sam Cook RedLock.net - Copyright 2017 Sam Cook + Copyright 2018 Sam Cook https://github.com/samcook/RedLock.net/blob/master/LICENSE https://github.com/samcook/RedLock.net https://raw.githubusercontent.com/samcook/RedLock.net/master/redlock-icon.png https://github.com/samcook/RedLock.net git RedLock Redis Distributed Lock - 2.0.0-pre3 - .NET Core release + 2.0.0 - .NET Core release False