From 473e773aeacbb92344388861692c9ca6a658d846 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 14 Jun 2021 00:55:11 +0000 Subject: [PATCH] fix deadlock --- copyparty/th_srv.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index d28c3f8f..902eac6a 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -154,7 +154,8 @@ class ThumbSrv(object): histpath = self.asrv.vfs.histtab[ptop] tpath = thumb_path(histpath, rem, mtime, fmt) abspath = os.path.join(ptop, rem) - cond = threading.Condition() + cond = threading.Condition(self.mutex) + do_conv = False with self.mutex: try: self.busy[tpath].append(cond) @@ -172,8 +173,11 @@ class ThumbSrv(object): f.write(fsenc(os.path.dirname(abspath))) self.busy[tpath] = [cond] - self.q.put([abspath, tpath]) - self.log("conv {} \033[0m{}".format(tpath, abspath), c=6) + do_conv = True + + if do_conv: + self.q.put([abspath, tpath]) + self.log("conv {} \033[0m{}".format(tpath, abspath), c=6) while not self.stopping: with self.mutex: