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
Percy
Percy6mo ago
Project ID: 98f66160-ce86-4b15-a73b-cab912256208
themkrage
themkrageOP6mo ago
98f66160-ce86-4b15-a73b-cab912256208/service/6221097a-1633-425a-b864-85d80f38795d
themkrage
themkrageOP6mo ago
here in the middle of the job, without warning, it restarts. the job never completes as a result
No description
themkrage
themkrageOP6mo ago
there is memory spike around this time, but it never passes the limit, so i wouldnt expect this to be hte reason
No description
themkrage
themkrageOP6mo ago
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?
ThallesComH
ThallesComH6mo ago
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
themkrage
themkrageOP6mo ago
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
ThallesComH
ThallesComH6mo ago
well time to use nodejs streams in some way
themkrage
themkrageOP6mo ago
im not familiar, whats that?
ThallesComH
ThallesComH6mo ago
stream the data instead of loading its entirety in memory
themkrage
themkrageOP6mo ago
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
ThallesComH
ThallesComH6mo ago
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
Want results from more Discord servers?
Add your server