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