nestjs/schedule

Add a CronExpression.NEVER expression

xegulon opened this issue · 6 comments

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

I want to programmatically choose the expression that I'll put in a @Cron() and sometimes (in some environments) I don't want the Cron job to execute.

Describe the solution you'd like

I'd like to have a new enum, name CronExpression.NEVER, that I can put into the @Cron

Teachability, documentation, adoption, migration strategy

No response

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

The motivation is that it is a clean solution. An alernative would be to use the scheduler registry in main.ts to stop the cron job, but it is less flexible.

Would you like to create a PR for this issue?

Would you like to create a PR for this issue?

Yeah I'll try! Alternatively, what about a disabled field in CronOptions?

In this file: lib/decorators/cron.decorator.ts

Sounds good

@xegulon Are you still working on this issue?

@origranot no sorry, would you like to do the PR?

@origranot no sorry, would you like to do the PR?

I would, I will take a look 💯