Skip to content
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

Dedup calls to LoadConfig #418

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Conversation

jshufro
Copy link
Contributor

@jshufro jshufro commented Dec 11, 2023

We often call cliutils.PrintNetwork(rp), which in turn calls rp.LoadConfig(), which then discards the result before it returns. The same functions often proceed to call rp.LoadConfig() again.

This isn't ideal for two reasons:

  1. If LoadConfig ever has side-effects, it may not be reentrant
  2. We parse stuff twice, which isn't slow but it isn't fast either.

Instead we can just add a function on RocketPoolConfig to get the network, and change cliutils.PrintNetwork to take that as an argument.

Copy link
Member

@0xfornax 0xfornax left a comment

Choose a reason for hiding this comment

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

LGTM

@0xfornax 0xfornax merged commit e3c42e9 into rocket-pool:master Dec 12, 2023
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.

2 participants