From 9e1ac3b1503263993753427d1d1c0c772d8457dd Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 11 Aug 2026 04:37:06 -0500 Subject: [PATCH] Shorts dedup: global room_id+day, one upload per room per day across all channels Co-authored-by: Cursor --- backend/app/shorts_pipeline.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/shorts_pipeline.py b/backend/app/shorts_pipeline.py index 406794a..bfebe7d 100644 --- a/backend/app/shorts_pipeline.py +++ b/backend/app/shorts_pipeline.py @@ -63,6 +63,10 @@ def _enqueue_job( if room_id.startswith("yt:"): return None day = push_date_from_ts(float((session or {}).get("started_at") or time.time())) + # Global dedup: same room_id can only be enqueued ONCE per Beijing day across ALL channels + if settings.get("shorts_dedupe_room_day", True) and room_id: + if db.has_shorts_job_for_room_day(room_id, day): + return None channel: dict[str, Any] | None = None if channel_pk: ch = db.get_shorts_channel(channel_pk) @@ -75,10 +79,6 @@ def _enqueue_job( channel = db.pick_shorts_channel(day, settings) if not channel: return None - # Dedup: same channel + same room_id within the same Beijing day is not allowed - if settings.get("shorts_dedupe_room_day", True) and room_id: - if db.has_shorts_job_for_room_day(room_id, day, channel_id=str(channel["id"])): - return None sid = str((session or {}).get("id") or room.get("active_session_id") or "") job = db.create_shorts_job( session_id=sid,