Search code examples
node.jsagenda

Agenda Job: now() make the job running multiple times


I am scheduling an Agenda Job as below:

await agenda.now("xyz");

But the above command makes my job running almost every 1 minute. But when I change it to

await agenda.every('5 minutes', "xyz");

The above works as expected i.e. it runs the job every 5 minutes.

But I don't want a recurring job. Rather run it once.


Solution

  • The issue was with the concurrency of the job definition. It was set to 10 because of which several instances of the same job were running in parallel.

    Changing the concurrency to 1 solved the issue.