From 337cad13f33395dd8ffdecb95b2be168bea2f9dd Mon Sep 17 00:00:00 2001 From: Gus Cairo Date: Wed, 25 Sep 2024 10:12:43 +0100 Subject: [PATCH] Default Wait for Ready to false (#6) ## Motivation The gRPC docs state that, when a transient failure is encountered, RPCs should fail immediately by default, without waiting for ready (https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md). However, we currently default `waitForReady` to true, meaning that RPCs may hang in cases such as when the TLS handshake fails or there are other issues when setting up the connection. ## Modifications Change the `waitForReady` default to `false`. ## Result We now more closely stick to gRPC's specification's advise. --- .../GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift b/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift index 7be28da..5908558 100644 --- a/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift +++ b/Sources/GRPCNIOTransportCore/Client/Connection/GRPCChannel.swift @@ -269,7 +269,7 @@ extension GRPCChannel { descriptor: MethodDescriptor, options: CallOptions ) async -> MakeStreamResult { - let waitForReady = options.waitForReady ?? true + let waitForReady = options.waitForReady ?? false switch self.state.withLock({ $0.makeStream(waitForReady: waitForReady) }) { case .useLoadBalancer(let loadBalancer): return await self.makeStream(