"use server"; import { safeRevalidate } from "../../lib/safeRevalidate"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import type { StreamActionResult } from "yt-dlp-transcript-common/jobs/streamCommand"; import { runBackfillChannelJob } from "yt-dlp-transcript-common/controller/operationJobs"; // Run the backfill lane over ONE channel, from its stage card. // // A THIN WRAPPER, and that is the whole of it now. This used to be a // hand-written copy of the sweep's per-channel job — the same runManagedFunction // call, the same batch, a summary line that had drifted (it printed `deferred` // and `blocked` where the sweep's printed `skipped`, so the same run read // differently depending on which button started it). The comment here claimed // the duplication existed because a hand-clicked run must be foreground and take // a queue override; both were already parameters of the function it was copying. // // What is left is what genuinely belongs to the editor: // - NO `background`, so a hand-clicked run goes in front of the sweep's. // - `onDone`, because common/ cannot import next/cache. The runner calls it at // job end and revalidatePath happens here, where Next exists. // - The stream comes back UNDRAINED, which the stage card's StreamActionLog // consumes to draw a live log. A runner that drained would kill it. export async function backfillChannelAction( slug: string, queueKey?: string, kindIds?: string[], // The video page's per-video Run passes exactly one id; a stage card passes // none and gets the whole channel, as before. ids?: string[], ): Promise { return runBackfillChannelJob({ paths: getPaths(), channelSlug: slug, kindIds, ids, queueKey, onDone: () => safeRevalidate([`/channels/${slug}`]), }); }