Reputation: 119
I want the user to fill in the cron expression and dynamically add the timing task according to the corn expression submitted by the user. If the corn expression is modified, the timing task is also modified accordingly. If the corn expression is deleted and the timing task is cancelled, Whether nodejs has a corresponding module can achieve this effect
Upvotes: 0
Views: 1724
Reputation: 51
You can use kue-scheduler
module for the same. You would require Redis
for using it.
The timestamp provided by the user can be used to schedule that task in Redis
.
When the timestamp expires, the event would be captured by your application (and you need to write a few lines for it) and execute the corresponding functionality.
You would need to give an identifier to these jobs to identify them in Redis
In case of an update, you can delete the old job and create a new job for the updated timestamp.
You can check for sample examples here and here.
Upvotes: 3