1.0.11 • Published 5 years ago

nestjs-rmq-test v1.0.11

Weekly downloads
14
License
MIT
Repository
github
Last release
5 years ago

NestJS cron Module

NestJS cron package allows you easily setup cron for your controllers or services.

npm i nestjs-cron

Then register module in your root app.module

import { CronModule } from 'nestjs-cron';

@Module({
	imports: [
		// ...
		CronModule.forRoot(),
	],
})
export class AppModule {}

To use cron, decorate your class with @Scheduled() and method with @Cron()

import { Cron, Scheduled } from 'nestjs-cron';

@Scheduled()
export class MyClass {
	@Cron('* * * * * *')
	async myMethod() {
		//...
	}
}

'* * * * * *' - is a standart cron notation. In this example it will be triggered every second. Additionaly you can use options:

@Cron('* * * * * *', {
	launchOnInit: true,
	sync: true,
})
  • launchOnInit - Launch job one time right after start
  • sync - Wait for method to finish before launching next tick if your function takes more time then cron.
1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago