Ignore importerror during interpreter shutdown while closing db

This commit is contained in:
Kovid Goyal 2022-08-06 09:42:36 +05:30
parent 1c8049eb21
commit 7f6f53149d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2461,13 +2461,17 @@ class Cache:
self.shutting_down = True self.shutting_down = True
self.event_dispatcher.close() self.event_dispatcher.close()
self._shutdown_fts() self._shutdown_fts()
from calibre.customize.ui import available_library_closed_plugins try:
for plugin in available_library_closed_plugins(): from calibre.customize.ui import available_library_closed_plugins
try: except ImportError:
plugin.run(self) pass # happens during interpreter shutdown
except Exception: else:
import traceback for plugin in available_library_closed_plugins():
traceback.print_exc() try:
plugin.run(self)
except Exception:
import traceback
traceback.print_exc()
self._shutdown_fts(stage=2) self._shutdown_fts(stage=2)
with self.write_lock: with self.write_lock:
self.backend.close() self.backend.close()