-
Notifications
You must be signed in to change notification settings - Fork 122
loop: wait for chain notifier server to start #377
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
Conversation
carlaKC
left a comment
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.
Just some nits!
| // try to re-attempt block epoch subscription. | ||
| select { | ||
| case <-time.After(50 * time.Millisecond): | ||
| continue |
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.
Perhaps add a log here that we're waiting for the chain notifier? Otherwise loop will just be hanging and user may not know why?
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.
Logging sounds good to me. And maybe increase the delay to 500ms to not spam lnd too much? It's got enough on its plate at this moment of startup anyway 😂
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.
Yeah the 50ms was a bit overkill :) Log added.
| return err | ||
| } | ||
|
|
||
| break |
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.
Do we need to break? Couldn't we just return err here? Either it's nil or it's a non-"process of starting" error.
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.
The function continues below. So getting here means we've succeeded with the connection.
guggero
left a comment
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 for the quick fix!
Just one nit, otherwise LGTM 💯
| return err | ||
| } | ||
|
|
||
| break |
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.
The function continues below. So getting here means we've succeeded with the connection.
| // try to re-attempt block epoch subscription. | ||
| select { | ||
| case <-time.After(50 * time.Millisecond): | ||
| continue |
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.
Logging sounds good to me. And maybe increase the delay to 500ms to not spam lnd too much? It's got enough on its plate at this moment of startup anyway 😂
89638eb to
a0b67da
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.
New record for fastest issue fix in loop! 🏁
LGTM
| if strings.Contains(err.Error(), | ||
| "in the process of starting") { | ||
|
|
||
| log.Warnf("LND chain notifier server not " + |
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: could just be Warn, but don't push again for this!
No description provided.