feat(m5d): demand-driven deep backfill + per-user ETA
Per-user opt-in to full-history (deep) backfill so a new user's unique channels no longer trigger a big shared-quota burst. - migration 0007: Subscription.deep_requested (default false); seed admins' existing subscriptions to preserve today's global-backfill behaviour - run_deep_backfill is now demand-driven: only channels at least one user has requested are deep-backfilled; recent backfill stays unconditional (cheap) - estimate_deep_backfill ETA helper (quota-bound) surfaced in /api/sync/my-status - POST /api/sync/deep-all to opt all my channels in; PATCH channels accepts deep_requested - UI: per-channel Full history toggle, Backfill everything action, deep progress + ETA in Channels header and Settings - Sync
This commit is contained in:
parent
bbcfd46ea9
commit
beb961c021
9 changed files with 256 additions and 18 deletions
|
|
@ -54,6 +54,7 @@ def list_channels(
|
|||
"stored_videos": stored.get(ch.id, 0),
|
||||
"priority": sub.priority,
|
||||
"hidden": sub.hidden,
|
||||
"deep_requested": sub.deep_requested,
|
||||
"tag_ids": tags_by_channel.get(ch.id, []),
|
||||
"details_synced": ch.details_synced_at is not None,
|
||||
"recent_synced": ch.recent_synced_at is not None,
|
||||
|
|
@ -86,8 +87,18 @@ def update_channel(
|
|||
sub.priority = int(payload["priority"])
|
||||
if "hidden" in payload:
|
||||
sub.hidden = bool(payload["hidden"])
|
||||
if "deep_requested" in payload:
|
||||
# Opt this channel into (or out of) full-history backfill. The deep scheduler
|
||||
# picks the flag up on its next run; turning it off won't undo already-fetched
|
||||
# videos, it just stops further deep paging if nobody else still wants it.
|
||||
sub.deep_requested = bool(payload["deep_requested"])
|
||||
db.commit()
|
||||
return {"id": channel_id, "priority": sub.priority, "hidden": sub.hidden}
|
||||
return {
|
||||
"id": channel_id,
|
||||
"priority": sub.priority,
|
||||
"hidden": sub.hidden,
|
||||
"deep_requested": sub.deep_requested,
|
||||
}
|
||||
|
||||
|
||||
@router.post("/{channel_id}/tags")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue