From a139dd594f2328ef9844d89c590f94d8ec6a3c41 Mon Sep 17 00:00:00 2001 From: Boshi Lian Date: Mon, 11 Nov 2024 07:14:46 -0800 Subject: [PATCH] Leader Election doesn't properly report OnError (#1594) Fixes #1593 --- src/KubernetesClient/LeaderElection/LeaderElector.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/KubernetesClient/LeaderElection/LeaderElector.cs b/src/KubernetesClient/LeaderElection/LeaderElector.cs index eb96b48a2..e7d86f9af 100644 --- a/src/KubernetesClient/LeaderElection/LeaderElector.cs +++ b/src/KubernetesClient/LeaderElection/LeaderElector.cs @@ -163,10 +163,9 @@ private async Task TryAcquireOrRenew(CancellationToken cancellationToken) { if (e.Response.StatusCode != HttpStatusCode.NotFound) { + OnError?.Invoke(e); return false; } - - OnError?.Invoke(e); } if (oldLeaderElectionRecord?.AcquireTime == null ||