mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-19 00:03:36 +00:00
Flush incremental caption updates on stop and failure
This commit is contained in:
@@ -195,6 +195,7 @@ class CaptionJobManager:
|
||||
return self.status()
|
||||
|
||||
def _prepare_and_run(self, library_ids: list[str], force: bool) -> None:
|
||||
caption_sync: CaptionMeiliSync | None = None
|
||||
try:
|
||||
init_db(settings.db_path)
|
||||
args = SimpleNamespace(
|
||||
@@ -265,7 +266,8 @@ class CaptionJobManager:
|
||||
self._run(args, rows, caption_sync)
|
||||
except CaptionJobStopped:
|
||||
self._set_gpu_busy(False)
|
||||
caption_sync.flush()
|
||||
if caption_sync is not None:
|
||||
caption_sync.flush()
|
||||
self._pause_requested.clear()
|
||||
self._stop_requested.clear()
|
||||
self._resume_event.set()
|
||||
@@ -283,7 +285,8 @@ class CaptionJobManager:
|
||||
)
|
||||
except Exception as exc:
|
||||
self._set_gpu_busy(False)
|
||||
caption_sync.flush()
|
||||
if caption_sync is not None:
|
||||
caption_sync.flush()
|
||||
self._progress(
|
||||
{
|
||||
"running": False,
|
||||
@@ -473,6 +476,7 @@ class CaptionJobManager:
|
||||
)
|
||||
except CaptionJobStopped:
|
||||
self._set_gpu_busy(False)
|
||||
caption_sync.flush()
|
||||
self._pause_requested.clear()
|
||||
self._stop_requested.clear()
|
||||
self._resume_event.set()
|
||||
@@ -489,6 +493,7 @@ class CaptionJobManager:
|
||||
)
|
||||
except Exception as exc:
|
||||
self._set_gpu_busy(False)
|
||||
caption_sync.flush()
|
||||
self._progress(
|
||||
{
|
||||
"running": False,
|
||||
|
||||
Reference in New Issue
Block a user