Skip to content

Conversation

@gacevicljubisa
Copy link
Member

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

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):

pkg/node/node.go Outdated
}

for _, nc := range closers {
wg.Add(1)
Copy link
Contributor

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

Copy link
Member Author

@gacevicljubisa gacevicljubisa Jun 2, 2025

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))

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

@acha-bill acha-bill left a 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)
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Member Author

@gacevicljubisa gacevicljubisa Jun 2, 2025

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 ?

Copy link
Collaborator

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.

Copy link
Contributor

@martinconic martinconic Jun 2, 2025

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")
Copy link
Contributor

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 ?

Copy link
Member Author

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.

@gacevicljubisa gacevicljubisa merged commit c466950 into master Jun 3, 2025
20 of 22 checks passed
@gacevicljubisa gacevicljubisa deleted the cleanup branch June 3, 2025 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants