Namespace `refresh` function should be reworked
Opened this issue · 0 comments
bsquizz commented
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
- inefficiently calling
deepcopy
even in instances wherenamespace_data
is already None, and - 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(...)