0

i want to send a notification for my users and I need check users states everyday and each user that get this situation send him/her notif. for this purpose i use agenda.js library. when I run this code i want to create a job Once and after that repeat call this job. so for this i write this code:

  const job = await agenda.create(SCHEDULE_MISS_YOU_NOTIF, data)
  job.repeatEvery('40 16 * * *', { timezone: 'Asia/Tehran' })
  await job.save()

but my problem is every time i run this code, immediately i get a notif and after that i get notif on time that scheduled. how can i remove first one notif and why this notif occure?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Fateme Ahmadi
  • 344
  • 1
  • 6
  • 18

1 Answers1

2
job.repeatEvery('40 16 * * *', {
  skipImmediate: true,
  timezone: 'Asia/Tehran'
});
Horatiu Jeflea
  • 7,256
  • 6
  • 38
  • 67