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()
|
return self.status()
|
||||||
|
|
||||||
def _prepare_and_run(self, library_ids: list[str], force: bool) -> None:
|
def _prepare_and_run(self, library_ids: list[str], force: bool) -> None:
|
||||||
|
caption_sync: CaptionMeiliSync | None = None
|
||||||
try:
|
try:
|
||||||
init_db(settings.db_path)
|
init_db(settings.db_path)
|
||||||
args = SimpleNamespace(
|
args = SimpleNamespace(
|
||||||
@@ -265,7 +266,8 @@ class CaptionJobManager:
|
|||||||
self._run(args, rows, caption_sync)
|
self._run(args, rows, caption_sync)
|
||||||
except CaptionJobStopped:
|
except CaptionJobStopped:
|
||||||
self._set_gpu_busy(False)
|
self._set_gpu_busy(False)
|
||||||
caption_sync.flush()
|
if caption_sync is not None:
|
||||||
|
caption_sync.flush()
|
||||||
self._pause_requested.clear()
|
self._pause_requested.clear()
|
||||||
self._stop_requested.clear()
|
self._stop_requested.clear()
|
||||||
self._resume_event.set()
|
self._resume_event.set()
|
||||||
@@ -283,7 +285,8 @@ class CaptionJobManager:
|
|||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self._set_gpu_busy(False)
|
self._set_gpu_busy(False)
|
||||||
caption_sync.flush()
|
if caption_sync is not None:
|
||||||
|
caption_sync.flush()
|
||||||
self._progress(
|
self._progress(
|
||||||
{
|
{
|
||||||
"running": False,
|
"running": False,
|
||||||
@@ -473,6 +476,7 @@ class CaptionJobManager:
|
|||||||
)
|
)
|
||||||
except CaptionJobStopped:
|
except CaptionJobStopped:
|
||||||
self._set_gpu_busy(False)
|
self._set_gpu_busy(False)
|
||||||
|
caption_sync.flush()
|
||||||
self._pause_requested.clear()
|
self._pause_requested.clear()
|
||||||
self._stop_requested.clear()
|
self._stop_requested.clear()
|
||||||
self._resume_event.set()
|
self._resume_event.set()
|
||||||
@@ -489,6 +493,7 @@ class CaptionJobManager:
|
|||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self._set_gpu_busy(False)
|
self._set_gpu_busy(False)
|
||||||
|
caption_sync.flush()
|
||||||
self._progress(
|
self._progress(
|
||||||
{
|
{
|
||||||
"running": False,
|
"running": False,
|
||||||
|
|||||||
Reference in New Issue
Block a user