Skip to content

Commit c9cf672

Browse files
committed
feat: simplify location DataFrame caching by removing threading lock
1 parent e089b32 commit c9cf672

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

transfers/thing_transfer.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# limitations under the License.
1515
# ===============================================================================
1616
import time
17-
from threading import Lock
1817
from types import SimpleNamespace
1918

2019
from pandas import isna
@@ -32,16 +31,15 @@
3231
)
3332

3433
_LOCATION_DF_CACHE = None
35-
_LOCATION_DF_LOCK = Lock()
3634

3735

3836
def _get_location_df():
3937
global _LOCATION_DF_CACHE
38+
# transfer_thing is executed in a session-scoped, non-threaded transfer flow.
39+
# Keep a simple module-level cache and avoid lock complexity here.
4040
if _LOCATION_DF_CACHE is None:
41-
with _LOCATION_DF_LOCK:
42-
if _LOCATION_DF_CACHE is None:
43-
df = read_csv("Location")
44-
_LOCATION_DF_CACHE = replace_nans(df)
41+
df = read_csv("Location")
42+
_LOCATION_DF_CACHE = replace_nans(df)
4543
return _LOCATION_DF_CACHE
4644

4745

0 commit comments

Comments
 (0)