feat(web): cache dashboard aggregations with version invalidation
This commit is contained in:
1 parent
91aa3e1f95
commit
9fd277c05f
15 files changed
+399
-30
No files matched your search
@@ -106,6 +106,8 @@ class DiscoveryService:
|
||||
self._handle_item(item, channel, cfg, summary, pending, now)
|
||||
|
||||
self._notify(pending, summary, now)
|
||||
if summary.candidates or summary.notified:
|
||||
self.repo.bump_cache_version("videos")
|
||||
summary.finished_at = self._now()
|
||||
self._log(
|
||||
"info" if not summary.errors else "warning",
|
||||
|
||||
@@ -176,6 +176,7 @@ class FavoriteActionService:
|
||||
aid=aid, folder_id=folder.media_id, position=position,
|
||||
already=already,
|
||||
)
|
||||
self.repo.bump_cache_version("videos")
|
||||
return ActionResult(
|
||||
ok=True, aid=aid, action="favorite", state="done",
|
||||
position=position, already_in_folder=already,
|
||||
@@ -201,6 +202,7 @@ class FavoriteActionService:
|
||||
message="候选不存在或已处理",
|
||||
)
|
||||
self.repo.mark_candidate_decision(aid, "rejected", now=self._now())
|
||||
self.repo.bump_cache_version("videos")
|
||||
return ActionResult(
|
||||
ok=True, aid=aid, action="ignore", state="rejected",
|
||||
message="已忽略",
|
||||
@@ -228,6 +230,7 @@ class FavoriteActionService:
|
||||
)
|
||||
rejected = self.repo.reject_pending_for_up(up_mid, now=self._now())
|
||||
self.repo.mark_candidate_decision(aid, "rejected", now=self._now())
|
||||
self.repo.bump_cache_version("videos")
|
||||
return ActionResult(
|
||||
ok=True, aid=aid, action="blacklist", state="rejected",
|
||||
message=f"已拉黑 UP,并忽略该 UP 的 {rejected} 条待决策候选",
|
||||
|
||||
@@ -200,6 +200,8 @@ class FolderSyncService:
|
||||
errors=len(summary.errors),
|
||||
elapsed=max(0, summary.finished_at - summary.started_at),
|
||||
)
|
||||
if summary.added or summary.removed or summary.refreshed:
|
||||
self.repo.bump_cache_version("videos")
|
||||
return summary
|
||||
|
||||
def _sync_folder(
|
||||
|
||||
@@ -284,6 +284,11 @@ class SnapshotService:
|
||||
|
||||
self._run_backup(cfg, stat_date, summary)
|
||||
|
||||
if summary.success or summary.removed or summary.failed:
|
||||
self.repo.bump_cache_version("videos")
|
||||
if summary.fans_ok or summary.fans_failed:
|
||||
self.repo.bump_cache_version("fans")
|
||||
|
||||
summary.finished_at = self._now()
|
||||
self._log(
|
||||
"info" if summary.completed else "warning",
|
||||
|
||||
Reference in new issue
Block a user