light: improve timeout functionality (#6145)

This commit is contained in:
Callum Waters
2021-02-18 23:49:24 +01:00
committed by GitHub
parent 27eb10a2e7
commit 29360f955c
4 changed files with 32 additions and 34 deletions
+5 -5
View File
@@ -206,11 +206,6 @@ func runProxy(cmd *cobra.Command, args []string) error {
return err
}
rpcClient, err := rpchttp.New(primaryAddr, "/websocket")
if err != nil {
return fmt.Errorf("http client for %s: %w", primaryAddr, err)
}
cfg := rpcserver.DefaultConfig()
cfg.MaxBodyBytes = config.RPC.MaxBodyBytes
cfg.MaxHeaderBytes = config.RPC.MaxHeaderBytes
@@ -222,6 +217,11 @@ func runProxy(cmd *cobra.Command, args []string) error {
cfg.WriteTimeout = config.RPC.TimeoutBroadcastTxCommit + 1*time.Second
}
rpcClient, err := rpchttp.NewWithTimeout(primaryAddr, "/websocket", cfg.WriteTimeout)
if err != nil {
return fmt.Errorf("failed to create http client for %s: %w", primaryAddr, err)
}
p := lproxy.Proxy{
Addr: listenAddr,
Config: cfg,