File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ import (
3939 "google.golang.org/grpc"
4040 "google.golang.org/grpc/credentials/insecure"
4141
42+ emulatorUtils "github.com/onflow/flow-emulator/utils"
43+
4244 "github.com/onflow/flowkit/v2"
4345 "github.com/onflow/flowkit/v2/config"
4446)
@@ -243,12 +245,16 @@ func NetworkToChainID(network string) (flow.ChainID, error) {
243245}
244246
245247// GetChainIDFromHost queries the given host directly to get its chain ID.
248+ // It will retry transient failures with exponential backoff using the emulator's gRPC retry interceptor.
246249func GetChainIDFromHost (host string ) (flowGo.ChainID , error ) {
247-
248- ctx , cancel := context .WithTimeout (context .Background (), 3 * time .Second )
250+ ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
249251 defer cancel ()
250252
251- conn , err := grpc .NewClient (host , grpc .WithTransportCredentials (insecure .NewCredentials ()))
253+ conn , err := grpc .NewClient (
254+ host ,
255+ grpc .WithTransportCredentials (insecure .NewCredentials ()),
256+ emulatorUtils .DefaultGRPCRetryInterceptor (),
257+ )
252258 if err != nil {
253259 return "" , fmt .Errorf ("failed to connect to %s: %w" , host , err )
254260 }
You can’t perform that action at this time.
0 commit comments