import Link from "next/link"; import { healthTimings, notAnsweringText, type LocationHealth, } from "yt-dlp-transcript-common/lib/storageHealth"; import { secondsText } from "yt-dlp-transcript-common/lib/storageHealthTimings"; // WHAT A PAGE THAT READS A CHANNEL'S `data/` SHOWS WHILE ITS DRIVE IS NOT // ANSWERING, instead of reading it. // // The videos list and the video page read the channel's media directory on // every render — a readdir, a stat per file, a metadata head read per title. On // a drive that is mounted and not answering (lib/storageHealth.ts) each of those // calls waits for the drive, on one of the few threads every page and poll in // this process shares. So the page asks the health state first, and on a // stalled drive it says so and reads nothing. The rest of the channel (its // overview, its report, its settings) comes off the corpus disk and still // renders. // // Server-only: it takes the health entry from the page, which read it from // memory — or from the DriveNotAnsweringError a page's read got from `onDrive`'s // watchdog. export function MediaNotAnswering({ slug, stall, what, }: { slug: string; // The stalled location, or null when the drive is on no location the health // state knows and a read of it did not answer within the budget // (`storage.health.budgetMs`). stall: LocationHealth | null; // What would have been shown: "The video list", "This video". what: string; }) { const timings = healthTimings(); return (
{stall ? ( <> {what} reads this channel's media, which is on “ {stall.label}” — a drive that is {notAnsweringText(stall)}. Nothing is read from it until it answers again (it is checked every{" "} {secondsText(timings.passIntervalMs)}). > ) : ( <> {what} reads this channel's media, and a read of its drive did not answer within {secondsText(timings.budgetMs)}. Nothing more is read from it on this page. > )}
The channel {" "} still shows its report, and{" "} Storage {" "} shows the drive.