Reputation: 41
I need some help. Here, you can see I created a Mongoose model and statics. In this system, a user can create tasks and assign them to employees. Additionally, the user can configure the date and time. The main factor is implementing a reminder system. Users can configure daily, weekly, or monthly reminders. If a user creates a task for 8 a.m. and repeats it daily, I need to handle cron jobs at 8 a.m. every day. Users can configure any time from 8 a.m. to 11:59 p.m.
For this scenario, handling cron jobs every minute is necessary because I don't know which user created tasks for specific times, like 8:10 a.m. and another at 8:11 a.m. However, creating cron jobs for every minute may overload the server due to frequent API calls. What is a good way to handle this efficiently? How do developers manage this type of system effectively?
I use Node.js, Express.js, and Mongoose. For cron jobs, I use the node-scheduler package.
Upvotes: 1
Views: 78