Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add an option to disable all schedule job when registering module. #491

Closed
michael-land opened this issue Mar 14, 2021 · 1 comment

Comments

@michael-land
Copy link

michael-land commented Mar 14, 2021

I'm submitting a...


[ ] Regression 
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

What is the motivation / use case for changing the behavior?

We have a lot of tasks running with nestjs schedule via @Cron(CronExpression). I hope there is an option to disabled all cronjob/interval/timeout when registering module via ScheduleModule.forRoot({ enabled: this.configService.isProd() }). it would make development and debug specific job easier.

Or is there alternative to run specific job only during development?

Also, it would be nice we can pass default time zone via ScheduleModule.forRoot(), so user can skip pass them everytime via @Cron(CronExpression,{ timeZone: ""})

@kamilmysliwiec
Copy link
Member

I hope there is an option to disabled all cronjob/interval/timeout when registering module

Create a Dynamic Module which conditionally imports the ScheduleModule. nI case you don't want to register any cron jobs/intervals/timeouts, simply don't register the module.

@nestjs nestjs locked and limited conversation to collaborators Mar 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants