A full round took 35-38 min of each hour and grew with every inspection the prober added. Triggers note changed releases in judge_dirty; the judge judges those (and releases a file hash of theirs tipped to repeated) by every rule, and every release in a daily full round for what time changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { BaseCommand, flags } from '@adonisjs/core/ace'
|
||
import type { CommandOptions } from '@adonisjs/core/types/ace'
|
||
import { ReleaseJudge, RULES } from '#services/release_judge'
|
||
|
||
/** The junk judge (REBUILD.md, junk): releases judged after their probes; verdicts hide them from search. */
|
||
export default class ReleasesJudge extends BaseCommand {
|
||
static commandName = 'releases:judge'
|
||
static description = 'Judges releases by what their probes showed (dead, fake, repeated, locked, unusable): the changed ones every few minutes, all daily'
|
||
static options: CommandOptions = { startApp: true, staysAlive: true }
|
||
|
||
@flags.boolean({ description: 'One full round, then exit' })
|
||
declare once: boolean
|
||
|
||
@flags.boolean({ description: 'With --once: count only, write no verdicts' })
|
||
declare dry: boolean
|
||
|
||
async run() {
|
||
const judge = new ReleaseJudge()
|
||
if (this.once) {
|
||
const round = await judge.full(this.dry)
|
||
for (const rule of RULES) {
|
||
const r = round.rules[rule.name]
|
||
if (r) this.logger.info(`${rule.name}: ${r.matched} (+${r.added} −${r.removed}) — ${rule.says}`)
|
||
}
|
||
await this.terminate()
|
||
return
|
||
}
|
||
let done: () => void
|
||
const finished = new Promise<void>((resolve) => (done = resolve))
|
||
this.app.terminating(async () => {
|
||
judge.stop()
|
||
await finished
|
||
})
|
||
await judge.run()
|
||
this.logger.info('Judge stopped.')
|
||
done!()
|
||
}
|
||
}
|