Non-functional change but more explicit.

Perhaps a bit subjective, but passing in a null value or a zero value controls whether the AcquireLockInternal will block or not, so probably better to provide an explicit Zero value from TryAcquireLock instead.
This commit is contained in:
Sipke Schoorstra
2015-08-22 18:10:43 +01:00
parent 3615cbe6db
commit 7673e2e12f

View File

@@ -72,7 +72,7 @@ namespace Orchard.Tasks.Locking.Services {
}
private bool TryAcquireLock(string name, TimeSpan maxValidFor, TimeSpan? timeout, string machineName, int? threadId, out DistributedLock @lock) {
@lock = AcquireLockInternal(name, maxValidFor, machineName, threadId, timeout.GetValueOrDefault());
@lock = AcquireLockInternal(name, maxValidFor, machineName, threadId, timeout ?? TimeSpan.Zero);
if (@lock != null)
return true;