import { BaseCommand } from '@adonisjs/core/ace' import type { CommandOptions } from '@adonisjs/core/types/ace' import Planner from '#services/planner' import NntpPool from '#services/nntp_pool' /** Cuts every active group's history (and new articles since) into ranges. */ export default class RangesPlan extends BaseCommand { static commandName = 'ranges:plan' static description = "Plans ranges for the indexed groups' articles" static options: CommandOptions = { startApp: true } async run() { try { const { groups, ranges } = await Planner.planAll() this.logger.info(`${ranges} ranges planned over ${groups} groups.`) } finally { await NntpPool.close() } } }