-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix problems with the node cache #441
Conversation
🚫 This pull request was closed and has been removed from the merge queue (details). |
@duboyal old_project_paginator = cript_api.search(node_type=cript.Project, search_mode=cript.SearchModes.UUID, value_to_search=str(new_project.uuid))
old_project_paginator.auto_load_nodes = False
old_json = next(old_project_paginator)
old_project_node, old_tree_cache = cript.load_nodes_from_json(normal_serial, _use_uuid_cache=dict()) And then you can go about it as discussed. Key here is, that you override the normal UUID cache with an empty dictionary in the This should automatically correspond to what we called the |
@@ -349,7 +350,22 @@ def load_nodes_from_json(nodes_json: Union[str, Dict]): | |||
# but catches a lot of odd cases. And at the moment performance is not bottle necked here | |||
if not isinstance(nodes_json, str): | |||
nodes_json = json.dumps(nodes_json) | |||
return json.loads(nodes_json, object_hook=node_json_hook) | |||
|
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.
💟
@@ -32,16 +29,26 @@ class JsonAttributes(BaseNode.JsonAttributes): | |||
|
|||
_json_attrs: JsonAttributes = JsonAttributes() | |||
|
|||
def __new__(cls, *args, **kwargs): | |||
uuid: Optional[str] = kwargs.get("uuid") |
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.
this fixes the bug that we had before.
Fun playing with something new like the __new__
/trunk merge |
Description
Now the node UUID cache actually works as intended.
Users can only have one python object with the same UUID.
Changes
Added a functionality that allows you to circumvent this cache explictly.
This should be a feature that users don't really use.
Known Issues
Notes
Checklist
CONTRIBUTORS.md
) in the pull request source branch.