From beee326efea33aa3554c1daf611b787283270e4e Mon Sep 17 00:00:00 2001 From: George Barnett Date: Mon, 29 Jan 2024 16:02:16 +0000 Subject: [PATCH] Make testHedgingWhenAllAttemptsResultInNonFatalCodes more reliable Motivation: `testHedgingWhenAllAttemptsResultInNonFatalCodes` fails occasionally. The reason for this is that when the event stating that next scheduled attempt is cancelled is consumed it cancels the next scheduled attempt again. However, this is incorrect, another hedged result may have re-scheduled an attempt which is subsequently cancelled by accident. Modifications: Don't double cancel the next scheduled attempt. result: The test passes more reliably --- .../Client/Internal/ClientRPCExecutor+HedgingExecutor.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift b/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift index aba9d9423..676dc8d37 100644 --- a/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift +++ b/Sources/GRPCCore/Call/Client/Internal/ClientRPCExecutor+HedgingExecutor.swift @@ -230,8 +230,7 @@ extension ClientRPCExecutor.HedgingExecutor { } case .cancelled: - // Cancelling also resets the state. - nextScheduledAttempt.cancel() + () } case .attemptCompleted(let outcome):