Skip to content
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

Deep copy txt units on local search to avoid race conditions #1118

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2,6 +2,7 @@
# Licensed under the MIT License
"""Algorithms to build context data for local search prompt."""

from copy import deepcopy
import logging
from typing import Any

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
Loading