Of 5,000 waiting inspection jobs, 3,212 were queued only because their stem looked random, and 2,044 of those were later RAR volumes (xyz.part47.rar, .r00) or par2 recovery volumes (.vol03+04.par2). Their first segment adds nothing: the set is listed from its first volume and named from its index .par2, as for readable names already. Each one cost a ~700 KB download; inspection pulled ~85 MB/s and fell behind the backfill. - isCandidate() rejects later volumes (isLaterVolume) before the random- name rule. - worker:file only queues files that are candidates, so the ~30% that inspection skips anyway no longer take queue slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { sevenZipVolume } from '../sevenzip/index.js'
|
|
|
|
/**
|
|
* Files whose first segment says what an archive holds: named first RAR
|
|
* volumes (.part01.rar, .rar), 7z (.7z, .7z.001) and `.bin`, an extension
|
|
* uploaders use for archive volumes too (sniffed by content).
|
|
*/
|
|
export function isArchiveStart(name: string): boolean {
|
|
if (/\.bin$/i.test(name)) return true
|
|
const volume = sevenZipVolume(name)
|
|
if (volume === 0 || volume === 1) return true
|
|
return /\.part0*1\.rar$/i.test(name) || (/\.rar$/i.test(name) && !/\.part\d+\.rar$/i.test(name))
|
|
}
|
|
|
|
/**
|
|
* A later RAR volume (.part02.rar, .r00) or a par2 recovery volume
|
|
* (.vol03+04.par2): the volume number is readable even under a random stem.
|
|
* The set is listed from its first volume and named from its index .par2,
|
|
* so the first segment of these says nothing new (LOG.md 2026-10-04).
|
|
*/
|
|
export function isLaterVolume(name: string): boolean {
|
|
const part = /\.part(\d+)\.rar$/i.exec(name)
|
|
if (part) return Number(part[1]) > 1
|
|
return /\.r\d{2,3}$/i.test(name) || /\.vol\d+[+-]\d+\.par2$/i.test(name)
|
|
}
|