Skip to content

Commit dbe2486

Browse files
authored
Add lock for cachetools (#2555)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change Fixes #1905 ## Are these changes tested? ## Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent 40521c8 commit dbe2486

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyiceberg/manifest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from __future__ import annotations
1818

1919
import math
20+
import threading
2021
from abc import ABC, abstractmethod
2122
from copy import copy
2223
from enum import Enum
@@ -875,7 +876,7 @@ def __hash__(self) -> int:
875876
return hash(self.manifest_path)
876877

877878

878-
@cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list))
879+
@cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list), lock=threading.RLock())
879880
def _manifests(io: FileIO, manifest_list: str) -> Tuple[ManifestFile, ...]:
880881
"""Read and cache manifests from the given manifest list, returning a tuple to prevent modification."""
881882
file = io.new_input(manifest_list)

0 commit comments

Comments
 (0)