Suggestion: Task Scheduling
marco-souza opened this issue · 1 comments
marco-souza commented
Is your feature request related to a problem? Please describe.
As a Nest.JS developer, I'd like the possibility of running cron jobs using the framework decorators and module system.
References:
Describe the solution you'd like
I imagine something like this:
- First we register the module at the App root module:
@Module({
imports: [
ScheduleModule.forRoot()
],
})
export class AppModule {}
- Then we can use the
@Cron
decorator to register listeners to timed events:
@Injectable()
export class TasksService {
private readonly logger = new Logger(TasksService.name);
@Cron('45 * * * * *')
handleCron() {
this.logger.debug('Called when the current second is 45');
}
}
The ScheduleModule
can be totally made using Deno native features, like the Deno.Cron module
Other than that, I think the implementation should be fairly similar to the Events
feature (#76)
Describe alternatives you've considered
marco-souza commented
I'll send a draft for this later this week 👍🏼