private void TryReleaseLeaseIfOwned() { try { if (HasLease) { Task.Run(() => _lockManager.ReleaseLockAsync(_lockHandle, CancellationToken.None)).GetAwaiter().GetResult(); _logger.PrimaryHostCoordinatorReleasedLocklLease(_websiteInstanceId); } } catch (Exception) { // Best effort, the lease will expire if we fail to release it. } }
private void TryReleaseLeaseIfOwned() { try { if (HasLease) { Task.Run(() => _lockManager.ReleaseLockAsync(_lockHandle, CancellationToken.None)).GetAwaiter().GetResult(); string message = $"Host instance '{_websiteInstanceId}' released lock lease."; _logger.LogDebug(message); } } catch (Exception) { // Best effort, the lease will expire if we fail to release it. } }
public async ValueTask DisposeAsync() { await lockManager .ReleaseLockAsync(lockHandle, CancellationToken.None) .ConfigureAwait(false); }