Skip to content

Commit

Permalink
Dropping folder lock in ThreadSafeFileWriter
Browse files Browse the repository at this point in the history
os.makedirs is already threadsafe
Fix #953
  • Loading branch information
Yomguithereal committed Apr 15, 2024
1 parent dab6b67 commit b3cbcf0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions minet/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ def __call__(
class ThreadSafeFileWriter(object):
def __init__(self, root_directory: Optional[str] = None, sqlar: bool = False):
self.root_directory = root_directory or ""
self.folder_locks = NamedLocks()
self.file_locks = NamedLocks()
self.sqlar = sqlar
self.archive = None
Expand All @@ -273,9 +272,8 @@ def makedirs(self, directory: str) -> None:
if not directory:
return

# TODO: cache
with self.folder_locks[directory]:
makedirs(directory, exist_ok=True)
# NOTE: os.makedirs is already threadsafe
makedirs(directory, exist_ok=True)

def write(
self,
Expand Down

0 comments on commit b3cbcf0

Please sign in to comment.