-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config: add rpctimeout #86
config: add rpctimeout #86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice addition, thanks!
config.go
Outdated
@@ -29,6 +29,9 @@ type lndConfig struct { | |||
// MacaroonName is the name of the macaroon in macaroon dir to use. | |||
MacaroonName string `long:"macaroonname" description:"The name of our macaroon in macaroon dir to use."` | |||
|
|||
// RPCTimeout is the timeout for rpc calls to lnd in seconds. | |||
RPCTimeout int `long:"rpctimeout" description:"The timeout for rpc calls to lnd in seconds"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this can be time.Duration
directly instead of int
, then the default can be 30 * time.Second
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much!
If I change this to time.Duration
that would require the user to specify a unit like: 60s
. Is that OK? Or is it better to abstract this from the user so they only have to enter an int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that's okay. Perhaps we should add a hint to the description, in lnd
we use a text like this: Valid time units are {s, m, h}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, that makes sense. Thanks for the reference to lnd
. I've pushed the update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just need to run make fmt
, then this looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
f868bdb
to
eba4e5e
Compare
eba4e5e
to
85302f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM⚡
This PR adds an option to set the lndclient RPCTimeout when initializing lndclient. This gives lndmon users the option to increase the timeout beyond the default 30 seconds in cases where the metrics take longer to return.
Note: If not specified, this argument defaults to 30 seconds, which is the lndclient default.
Additional context:
We use lndmon for our lnd nodes running in Kubernetes and get frequent timeouts due to latency specific to nodes running with a PostgreSQL backend. As such, it often takes longer than 30 seconds for lndmon to gather metrics resulting in our lndmon pods frequently going into a crashloop status. In issue:78 it was suggested that this could be addressed, on the lndmon side, by increasing the lndclient timeout. This seems to be a good workaround for us so I wanted to present this PR for consideration. Thank you!