@eggjs/tegg-schedule-decorator
Install
npm i --save @eggjs/tegg-schedule-decorator
Define schedule subscriber
import { Schedule } from '@eggjs/tegg';
@Schedule<IntervalParams>({
type: ScheduleType.WORKER,
scheduleData: {
interval: 100,
},
})
export class FooSubscriber {
@Inject()
private readonly logger: EggLogger;
async subscribe() {
this.logger.info('schedule called');
}
}
@Schedule<CronParams>({
type: ScheduleType.WORKER,
scheduleData: {
cron: '0 0 3 * * *',
},
})
export class FooSubscriber {
@Inject()
private readonly logger: EggLogger;
async subscribe() {
this.logger.info('schedule called');
}
}