Skip to content

Sweep

Sweep(name, schedule): MethodDecorator

Runs the method on a schedule, once per tick across every replica.

@Sweep('token-cleanup', { cron: '0 * * * *', tz: 'UTC' })
async cleanup(ctx: SweepContext) { ... }

The name is the scheduler’s id: renaming a sweep removes the old scheduler at the next boot. A failure is counted, reported and logged by the runtime; the method does not need its own try/catch, and the next tick is the retry.

string

SweepSchedule

MethodDecorator