From ea8140428d6aceec674270444f4d559d145a094d Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 7 Dec 2023 19:49:26 +0100 Subject: [PATCH] config+faraday: allow lnd request timeout to be configured --- config.go | 3 +++ faraday.go | 1 + 2 files changed, 4 insertions(+) diff --git a/config.go b/config.go index 475af83..9620503 100644 --- a/config.go +++ b/config.go @@ -106,6 +106,9 @@ type LndConfig struct { // TLSCertPath is the path to the tls cert that faraday should use. TLSCertPath string `long:"tlscertpath" description:"Path to TLS cert"` + + // RequestTimeout is the maximum time to wait for a response from lnd. + RequestTimeout time.Duration `long:"requesttimeout" description:"The maximum time to wait for a response from lnd, if not set the default of 30 seconds will be used."` } type Config struct { //nolint:maligned diff --git a/faraday.go b/faraday.go index f3a1d60..7363e8b 100644 --- a/faraday.go +++ b/faraday.go @@ -76,6 +76,7 @@ func Main() error { CustomMacaroonPath: config.Lnd.MacaroonPath, TLSPath: config.Lnd.TLSCertPath, CheckVersion: MinLndVersion, + RPCTimeout: config.Lnd.RequestTimeout, }) if err != nil { return fmt.Errorf("cannot connect to lightning services: %v",