Issue with node-cron Jobs behaving differently in different environments
I have a strange issue where I have a chron job that behaves properly in my development environment (ie. it runs once a day at the specified time) but in the production environment it runs every minute. The code is exactly the same (it's reading from the same git repository and commit.) Has anyone run into this problem?
13 Replies
Project ID:
1432f531-5304-4aa9-8f24-aee5ff595721
1432f531-5304-4aa9-8f24-aee5ff595721
in code cron like node-cron or railways cron?
in code
then if its an in code schedular that would be an issue with the code
while this is super strange and unfortunately i couldn’t tell you why thats happening, it still would be a code issue
but why would i only see the issue in the production environment but not in the development env. and would you recommend that i use the railways cron instead (not sure how) to avoid this issue
i honestly have no clue why, but it can only be a code issue though, you are doing an in code schedular, and railway will only ever run your code as is
is there any chance it could be related to the postgres and redis (i have different ones for the different environments). In other words could be the case that these different data bases are causing different behavior
(basically this is the only different between the two environments)
again, im sorry but i dont have a clue, but you cant rule it out. at the core of this, it would still be a code issue
k thanks! will continue to trouble shoot and post an answer where if i figure it out in case someone else runs into the same things
sounds good
So the issue was actually that the cache in the redis needed to be cleared. This appears to have solved the problem.
glad to hear it