Shorts dedup: global room_id+day, one upload per room per day across all channels

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-08-11 04:37:06 -05:00
parent 765501e225
commit 9e1ac3b150

View File

@ -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,