start testing fts pool

This commit is contained in:
Kovid Goyal 2022-02-18 19:43:47 +05:30
parent cb74720aa5
commit 6fb3061c56
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -4,10 +4,11 @@
import builtins
import sys
import time
from io import BytesIO
from calibre.db.tests.base import BaseTest
from calibre.db.fts.text import html_to_text
from calibre.db.tests.base import BaseTest
def print(*args, **kwargs):
@ -28,6 +29,14 @@ class FTSAPITest(BaseTest):
from calibre_extensions.sqlite_extension import set_ui_language
set_ui_language('en')
def test_fts_pool(self):
cache = self.init_cache()
fts = cache.enable_fts(start_pool=True)
st = time.monotonic()
while fts.all_currently_dirty() and time.monotonic() - st < 2:
fts.pool.supervisor_thread.join(0.01)
self.assertFalse(fts.all_currently_dirty())
def test_fts_triggers(self):
cache = self.init_cache()
fts = cache.enable_fts(start_pool=False)