mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-19 00:03:36 +00:00
Keep incremental caption sync polling lightweight
This commit is contained in:
+14
-10
@@ -149,18 +149,16 @@ class CaptionMeiliSync:
|
||||
self.updated_total = 0
|
||||
self.last_error: str | None = None
|
||||
|
||||
def _report(self) -> None:
|
||||
def _report(self, *, pending: int | None = None) -> None:
|
||||
if self.progress is None:
|
||||
return
|
||||
self.progress(
|
||||
{
|
||||
"meili_documents_updated": self.updated_total,
|
||||
"meili_sync_pending": count_unsynced_caption_frames(
|
||||
self.library_ids
|
||||
),
|
||||
"meili_sync_error": self.last_error,
|
||||
}
|
||||
)
|
||||
update: dict[str, Any] = {
|
||||
"meili_documents_updated": self.updated_total,
|
||||
"meili_sync_error": self.last_error,
|
||||
}
|
||||
if pending is not None:
|
||||
update["meili_sync_pending"] = pending
|
||||
self.progress(update)
|
||||
|
||||
def add(self, frame_id: str) -> None:
|
||||
self.pending.append(str(frame_id))
|
||||
@@ -215,6 +213,12 @@ class CaptionMeiliSync:
|
||||
if count == 0:
|
||||
break
|
||||
|
||||
pending = (
|
||||
count_unsynced_caption_frames(self.library_ids)
|
||||
if self.last_error
|
||||
else 0
|
||||
)
|
||||
self._report(pending=pending)
|
||||
return caught_up
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user