Fix FTS indexing not progressing when dirtied books have no actual changes

This commit is contained in:
Kovid Goyal 2022-08-06 10:47:04 +05:30
parent 74ec8db8fc
commit 634bb31f24
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

@ -520,7 +520,9 @@ class Cache:
h.update(chunk)
pt.write(chunk)
with self.write_lock:
self.backend.queue_fts_job(book_id, fmt, pt.name, sz, h.hexdigest())
queued = self.backend.queue_fts_job(book_id, fmt, pt.name, sz, h.hexdigest())
if not queued: # means a dirtied book was removed
self._update_fts_indexing_numbers()
return self.backend.fts_has_idle_workers
def loop_while_more_available():

View File

@ -171,7 +171,7 @@ class Pool:
@property
def num_of_idle_workers(self):
return sum(1 if w.working else 0 for w in self.workers)
return sum(0 if w.working else 1 for w in self.workers)
def check_for_work(self):
self.initialize()