-1

I want to make a service in nodejs that will perform some task for different users in different time. I have some idea about node-corn. But it do task in fixed time for one user i guess. Can i write any servic for multiple user in different time

const cron = require('node-cron');
cron.schedule("* 1 * * * *", function() {
    console.log("---------------------");
    console.log("Running Cron Job every one Hours");
});
Jamal Abo
  • 472
  • 4
  • 16

1 Answers1

1
  1. Create a job queue table/collection with a task activation field, You can use MongoDB or Mysql for that.
  2. Push items to it with appropriate props
  3. Develop a job scheduler (Can be a cron enabled AWS Lambda function) polls this table for new tasks & execute a task based on the activation time.
Manzoor Samad
  • 889
  • 1
  • 9
  • 16