alfonsotrocoli
How to maintain node-cron in my NestJS project when setting more replicas
Hi! I have a project deployed in railway in NestJS and it has some cron jobs on it. I was just wondering once I scale in more replicas in a future, how should I treat those cronjobs? Is there any way I can know for example the replica number in an env variable so I can only run the cron on one replica? There's any walkaround rather than doing another service? Thank you 🙂
10 replies