a year ago
So I have a usecase which I am not sure how to solve:
Users can perform imports on my application which last 5-6 hours and are non-resumable. I want a way to keep old containers running until an import is running even when I deploy a new version. Is this possible?
28 Replies
a year ago
You can extend how long previous containers keep running, but you can't keep them running indefinitely
I want all old containers to keep running for 12 hrs but dont want requests to be routed to them
a year ago
you can set a service variable RAILWAY_DEPLOYMENT_OVERLAP_SECONDS to the amount of additional seconds you want the deployment to be running
I can't remember what the max amount is though, I think it was a few hours
a year ago
It's how long Railway will keep the previous deployment running when you make a new deployment
a year ago
typically when you create a new deployment, Railway keeps the previous one running for about 20 seconds just to ensure the new one takes over seamlessly
a year ago
I'm not sure, if you want to be sure then you could use RAILWAY_DEPLOYMENT_DRAINING_SECONDS instead
what this does is Railway will send your container a SIGTERM first, your app can then take that and start finishing jobs and not accept new ones
then once your app finishes all active jobs it can exit by itself (the amount of seconds you specify in this case is how long until Railway forces your app to close with SIGKILL)
a year ago
in what way is it not working? Does the previous container get removed regardless?
a year ago
can you try redeploying again
unfortunately the background job itself is written in a way that it is not resumable. so this is not very helful for me
a year ago
it wouldn't have to resume because you would never have to pause it
a year ago
Strange, perhaps it's above the max amount? I completely forgot what the max amount is 😔
a year ago
you want draining not overlap
a year ago
this then
a year ago
5.5hr should be fine

