fix deadlock on rescan during upload

This commit is contained in:
ed 2022-04-29 23:14:51 +02:00
parent d4b51c040e
commit e82f176289

View file

@ -781,6 +781,7 @@ class Up2k(object):
if self.mtag.prefer_mt and self.args.mtag_mt > 1:
mpool = self._start_mpool()
# TODO blocks writes to registry cursor; do chunks instead
conn = sqlite3.connect(db_path, timeout=15)
cur = conn.cursor()
c2 = conn.cursor()
@ -806,7 +807,7 @@ class Up2k(object):
n_tags = self._tag_file(c3, *args)
else:
mpool.put(["mtag"] + args)
with self.mutex:
# not registry cursor; do not self.mutex:
n_tags = len(self._flush_mpool(c3))
n_add += n_tags
@ -830,9 +831,6 @@ class Up2k(object):
cur.close()
conn.close()
with self.mutex:
gcur.connection.commit()
return n_add, n_rm, True
def _flush_mpool(self, wcur):