Cron Jobs
Task Scheduling (CRON) in VitNode.
We're using @nestjs/schedule to schedule tasks. CRON is a time-based job scheduler in Unix-like operating systems. It enables users to schedule jobs (commands or scripts) to run periodically at fixed times, dates, or intervals.
Usage
Create a service for cron jobs.
Register the service in your module providers
array.
CRON Expression
The @Cron()
decorator supports the following standard cron patterns:
Asterisk (e.g. *
)
Ranges (e.g. 1-3,5
)
Steps (e.g. */2
)
Or you can use a CronExpression
enum.