-
Notifications
You must be signed in to change notification settings - Fork 380
fix: remove sleep and refactor code #5107
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
pkg/node/node.go
Outdated
| } | ||
|
|
||
| for _, nc := range closers { | ||
| wg.Add(1) |
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.
Add to wg before the loop
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.
Add to wg before the loop
You mean:
wg.Add(len(closers))?
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
acha-bill
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.
Nice. Once small comment
| } | ||
|
|
||
| fmt.Print(beeWelcomeMessage) | ||
| time.Sleep(5 * 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.
I was thinking, if the purpose for this sleep is to have beeWelcomeMessage more visible to the users, it would make sense to have this sleep only if the bee is in the terminal. This is just a suggestion, to use term.IsTerminal(int(os.Stdout.Fd())) instead. But only if there is an actual need to have such wait.
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.
In the spirit of enhancing the node spinup time, I think we can remove it. - even in terminal.
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.
I vote to remove time.Sleep..
@niki ?
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.
it's not pretty clear to me what the sleep time has been used for. if its presence affects the node spinup, then sure, remove it. But we need to consider all possible cases it might have an effect on.
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 sleep time was introduced as part of the tribute to ldeffenb , so we can have some seconds to read the quote. I think we can remove now the sleep.
| } | ||
|
|
||
| tryClose(b.ethClientCloser, "eth client") | ||
| tryClose(b.accesscontrolCloser, "accesscontrol") |
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.
Why did you not include all Closers into namedCloser ?
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.
With this refactoring, goal was to have the same execution order and reduce the amount of code in same time.
Checklist
Description
Remove time sleep on node start and improve the code in node shutdown.
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):