import { CronJob } from 'cron'; export interface Scheduler { register(cron: string, timeZone: string, run: () => Promise): () => void; } export class PluginScheduler implements Scheduler { register(cron: string, timeZone: string, run: () => Promise): () => void { const job = new CronJob(cron, () => { void run().catch(() => undefined); }, null, true, timeZone); return () => job.stop(); } }