Skip to content

Commit

Permalink
feat: Fix bug in dedupe_node_list function (#137)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danielchalef authored Sep 21, 2024
1 parent 6d065d3 commit 32b5153
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions graphiti_core/utils/maintenance/node_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32b5153

Please sign in to comment.