miaowing / nest-schedule

A cron-like and not-cron-like job distributed scheduler for Nest.js by decorators.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Cron() decorator not working

AlariCode opened this issue · comments

Thanks for a great plugin for nest. @Interval decorator is working perfectly, but I can't start @Cron.

import { Injectable } from '@nestjs/common';
import { Cron, NestSchedule } from 'nest-schedule';

@Injectable()
export class ScheduleService extends NestSchedule {  
  constructor() {
    super();
  }
  
  @Cron('* * * * *')
  clear() {
    console.log('clear data ...');
  }
}

No log in console every minute.

Dependencies:

"dependencies": {
    "@nestjs/common": "^5.0.0",
    "@nestjs/core": "^5.0.0",
    ...
}
commented

I have fix it, you can try the latest version 0.3.1, thks~.😁

Thank you! You are lightning fast)