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

Namespace refresh function should be reworked #226

Open
bsquizz opened this issue May 27, 2022 · 0 comments
Open

Namespace refresh function should be reworked #226

bsquizz opened this issue May 27, 2022 · 0 comments

Comments

@bsquizz
Copy link
Collaborator

bsquizz commented May 27, 2022

The way the refresh function is written is confusing since it is used as both an initializer function AND a refresh function.

Looking at the name of the function, one would usually assume that new JSON is going to be fetched every time but actually if namespace_data is passed to it, it does not call get_json.

https://github.com/RedHatInsights/bonfire/blob/master/bonfire/namespaces.py#L124

Also, we are

  1. inefficiently calling deepcopy even in instances where namespace_data is already None, and
  2. throwing away the deepcopy accidentally on this line: https://github.com/RedHatInsights/bonfire/blob/master/bonfire/namespaces.py#L124

This should be:

self._data = self._data or get_json(...)
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

No branches or pull requests

1 participant