Skip to content

Commit

Permalink
Deep copy txt units on local search to avoid race conditions (#1118)
Browse files Browse the repository at this point in the history
* Deep copy txt units on local search to avoid race conditions

* Format
  • Loading branch information
AlonsoGuevara authored Sep 11, 2024
1 parent e7ee8cb commit cdf5fc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20240910212339849025.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Deep copy txt units on local search to avoid race conditions"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Algorithms to build context data for local search prompt."""

import logging
from copy import deepcopy
from typing import Any

import pandas as pd
Expand Down Expand Up @@ -319,7 +320,7 @@ def _build_text_unit_context(
for text_id in entity.text_unit_ids or []:
if text_id not in text_unit_ids_set and text_id in self.text_units:
text_unit_ids_set.add(text_id)
selected_unit = self.text_units[text_id]
selected_unit = deepcopy(self.text_units[text_id])
num_relationships = count_relationships(
selected_unit, entity, self.relationships
)
Expand Down

0 comments on commit cdf5fc4

Please sign in to comment.