Skip to content

Commit

Permalink
Use fresh sfs instances for rsync threads
Browse files Browse the repository at this point in the history
  • Loading branch information
bhperry committed Mar 5, 2024
1 parent a7b4a8a commit 1cdae69
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions saturnfs/client/saturnfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class SaturnFS(AbstractFileSystem, metaclass=_CachedTyped): # pylint: disable=i
protocol = "sfs"

def __init__(self, *args, **storage_options):
if self._cached:
# reusing instance, don't change
return
self.object_storage_client = ObjectStorageClient()
self.file_transfer = FileTransferClient()
weakref.finalize(self, self.close)
Expand Down Expand Up @@ -1280,7 +1283,8 @@ async def _cp_file(
if self._is_local(proto1) and self._is_saturnfs(proto2):
if blocksize < settings.S3_MIN_PART_SIZE:
blocksize = settings.S3_MIN_PART_SIZE
sfs = SaturnFS()
# Ensure fresh instance for dedicated client sessions per thread
sfs = SaturnFS(skip_instance_cache=True)
return await self.loop.run_in_executor(
self._thread_pool,
partial(
Expand All @@ -1293,7 +1297,8 @@ async def _cp_file(
),
)
elif self._is_saturnfs(proto1) and self._is_local(proto2):
sfs = SaturnFS()
# Ensure fresh instance for dedicated client sessions per thread
sfs = SaturnFS(skip_instance_cache=True)
return await self.loop.run_in_executor(
self._thread_pool,
partial(
Expand Down

0 comments on commit 1cdae69

Please sign in to comment.