feat: Fix bug in dedupe_node_list function (#137)

The code changes fix a bug in the `dedupe_node_list` function where a node instance was not found in the node map. The bug is now handled by logging a warning message and skipping the iteration. This ensures that the function continues to execute without any errors.
This commit is contained in:
Daniel Chalef 2024-09-20 21:03:20 -07:00 committed by GitHub
parent 6d065d363a
commit 32b51530ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -272,9 +272,12 @@ async def dedupe_node_list(
unique_nodes = []
uuid_map: dict[str, str] = {}
for node_data in nodes_data:
node = node_map[node_data['uuids'][0]]
node.summary = node_data['summary']
unique_nodes.append(node)
node_instance: EntityNode | None = node_map.get(node_data['uuids'][0])
if node_instance is None:
logger.warning(f'Node {node_data["uuids"][0]} not found in node map')
continue
node_instance.summary = node_data['summary']
unique_nodes.append(node_instance)
for uuid in node_data['uuids'][1:]:
uuid_value = node_map[node_data['uuids'][0]].uuid