mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
feat: make subscribe deletion reports durable
This commit is contained in:
@@ -98,6 +98,7 @@ class DeleteSubscribeCommand:
|
||||
candidate.event_payload,
|
||||
)
|
||||
event_key = event_payload["idempotency_key"]
|
||||
report_key = f"{event_key}:report"
|
||||
try:
|
||||
if self._outbox:
|
||||
await self._outbox.stage(
|
||||
@@ -108,6 +109,17 @@ class DeleteSubscribeCommand:
|
||||
),
|
||||
datetime.now(timezone.utc),
|
||||
)
|
||||
await self._outbox.stage(
|
||||
OutboxIntent(
|
||||
event_key=report_key,
|
||||
topic="subscribe.deleted.report",
|
||||
payload={
|
||||
"idempotency_key": report_key,
|
||||
"subscribe_info": dict(candidate.event_payload),
|
||||
},
|
||||
),
|
||||
datetime.now(timezone.utc),
|
||||
)
|
||||
await self._unit_of_work.commit()
|
||||
except Exception:
|
||||
await self._unit_of_work.rollback()
|
||||
@@ -121,7 +133,14 @@ class DeleteSubscribeCommand:
|
||||
)
|
||||
# 上报适配器会自行白名单过滤公开字段;传完整删除前快照可保留音乐实体维度,
|
||||
# 避免 Agent 与 API 入口收敛后丢失 music_type / total_tracks。
|
||||
self._report_deleted(dict(candidate.event_payload))
|
||||
report_result = self._report_deleted(dict(candidate.event_payload))
|
||||
if report_result is False:
|
||||
raise RuntimeError("订阅删除统计上报未确认")
|
||||
if self._outbox:
|
||||
await self._outbox.complete_by_event_key(
|
||||
report_key,
|
||||
datetime.now(timezone.utc),
|
||||
)
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user