Skip to content

Commit f3683ba

Browse files
d-j-hattonstephen-riggs
authored andcommitted
Allow the avoidance of the creation of a thread inside rsyncer finalisation
1 parent 1671bb0 commit f3683ba

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/murfey/client/multigrid_control.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def _finalise_rsyncer(self, source: Path):
159159
finalise_thread = threading.Thread(
160160
name=f"Controller finaliser thread ({source})",
161161
target=self.rsync_processes[source].finalise,
162+
kwargs={"thread": False},
162163
daemon=True,
163164
)
164165
finalise_thread.start()

src/murfey/client/rsync.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,21 @@ def stop(self):
172172
self.thread.join()
173173
logger.debug("RSync thread stop completed")
174174

175-
def finalise(self):
175+
def finalise(self, thread: bool = True):
176176
self.stop()
177177
self._remove_files = True
178178
self._notify = False
179-
self.thread = threading.Thread(
180-
name=f"RSync finalisation {self._basepath}:{self._remote}",
181-
target=self._process,
182-
daemon=True,
183-
)
184-
for f in self._basepath.glob("**/*"):
185-
self.queue.put(f)
186-
self.stop()
179+
if thread:
180+
self.thread = threading.Thread(
181+
name=f"RSync finalisation {self._basepath}:{self._remote}",
182+
target=self._process,
183+
daemon=True,
184+
)
185+
for f in self._basepath.glob("**/*"):
186+
self.queue.put(f)
187+
self.stop()
188+
else:
189+
self._transfer(list(self._basepath.glob("**/*")))
187190

188191
def enqueue(self, file_path: Path):
189192
if not self._stopping:

0 commit comments

Comments
 (0)