#Issue with node-cron Jobs behaving differently in different environments

17 messages · Page 1 of 1 (latest)

ancient flint
#

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?

gloomy sealBOT
#

Project ID: 1432f531-5304-4aa9-8f24-aee5ff595721

lavish wigeonBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

ancient flint
#

1432f531-5304-4aa9-8f24-aee5ff595721

soft oak
#

in code cron like node-cron or railways cron?

ancient flint
#

in code

soft oak
#

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

ancient flint
#

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

soft oak
#

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

ancient flint
#

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)

soft oak
#

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

ancient flint
#

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

soft oak
#

sounds good

soft oak
#

Issue with node-cron Jobs behaving differently in different environments

ancient flint
#

So the issue was actually that the cache in the redis needed to be cleared. This appears to have solved the problem.