Prevent UnobservedTaskException in LeaderElector (#1420)

* Prevent UnobservedTaskException  in LeaderElector

* Loggin exception
This commit is contained in:
Vladimír Kleštinec
2023-10-10 00:52:23 +02:00
committed by GitHub
parent 7b6d1d8cc1
commit 7cdebbf516

View File

@@ -211,8 +211,11 @@ namespace k8s.LeaderElection
// wait RetryPeriod since acq return immediately // wait RetryPeriod since acq return immediately
await Task.Delay(delay, cancellationToken).ConfigureAwait(false); await Task.Delay(delay, cancellationToken).ConfigureAwait(false);
} }
else
// else timeout {
// else timeout
_ = acq.ContinueWith(t => OnError?.Invoke(t.Exception), TaskContinuationOptions.OnlyOnFaulted);
}
} }
finally finally
{ {