diff --git a/Directory.Packages.props b/Directory.Packages.props index d472b9086f..c184880a62 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + diff --git a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs index 58d67e1caf..15956b159e 100644 --- a/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs +++ b/framework/src/Volo.Abp.DistributedLocking.Abstractions/Volo/Abp/DistributedLocking/LocalAbpDistributedLock.cs @@ -30,12 +30,11 @@ public class LocalAbpDistributedLock : IAbpDistributedLock, ISingletonDependency Check.NotNullOrWhiteSpace(name, nameof(name)); var key = DistributedLockKeyNormalizer.NormalizeKey(name); - var timeoutReleaser = await _localSyncObjects.LockAsync(key, timeout, cancellationToken); - if (!timeoutReleaser.EnteredSemaphore) + var timeoutReleaser = await _localSyncObjects.LockOrNullAsync(key, timeout, cancellationToken); + if (timeoutReleaser is not null) { - timeoutReleaser.Dispose(); - return null; + return new LocalAbpDistributedLockHandle(timeoutReleaser); } - return new LocalAbpDistributedLockHandle(timeoutReleaser); + return null; } }