public bool AcquireLock() { _lockToken = _mutex.AcquireLockAsync(_lockName, _options.LeasePeriod).GetAwaiter().GetResult(); _renewLeaseTimer.Start(); return(_lockToken != null); }
public bool AcquireLock() { if (Disabled) { _logger.LogWarning($"Bypassing the expected lock. DistributedLock for {typeof(T).Name} is disabled in configuration"); return(true); } _lockToken = _mutex.AcquireLockAsync(_lockName, _options.LeasePeriod).GetAwaiter().GetResult(); _renewLeaseTimer.Start(); return(_lockToken != null); }