Cron-Job using node-cron is stopping mid execution
Hi! I am running like 5-10 cron- jobs in one instance of node-cron being run. I notice that when multiple jobs overlap at the same time, Railway restarts the instance. I looked into resource usage, and nothing passes any set limits for the instance, but there is certainly a spike.
How can I see why Railway restarted my container? I haven't beeen able to answer this in the UI
12 Replies
Project ID:
98f66160-ce86-4b15-a73b-cab912256208
98f66160-ce86-4b15-a73b-cab912256208/service/6221097a-1633-425a-b864-85d80f38795d
here in the middle of the job, without warning, it restarts. the job never completes as a result
there is memory spike around this time, but it never passes the limit, so i wouldnt expect this to be hte reason
and then, 2 minutes after this restart, another job starts. That could also cause this somehow?
How can i reach out to Railway to understand why the job was shut down?
im 99% sure that your app reached max memory limit and was killed because of that.
the graph might not show but we had problems like that in the past
but anyway, you're on pro plan, just send them an email
Good to know. This job is just a bit database write, so im a bit surpirsed we hit the memory limit! I will look into it and see if there's something up. Thanks!
Good point lol
well time to use nodejs streams in some way
im not familiar, whats that?
stream the data instead of loading its entirety in memory
oh interesting. havent played around with that. i was just going to decrease the chunk for this write job haha, but that seems like a better solution
yeah your solution might be better if you just need to do that a few times a day and the data you're feeding doesnt scale