37 Replies
Project ID:
N/A
n/a
yes there is, what's the usecase?
So the case is i want to redeploy it every 24 hours, if that is allowed
okay but what's the reason you want to do that
Better performance for my discord bot.
Railway has a built in cron service redeployer
Service => settings => chron schedule
this should redeploy your service every day at 12AM
Thank you!
that will not do what they want
it won't restart because something will already be running
But i tried it and it re deployed my service even if it was already running
did the status say complete?
It was active and then it removed the previous deployment
the changelog said they have changed that behaviour to wait for previous deployments to complete
What do you mean for complete? The is a complete state?
Isn't there removed, failed, active, building and initializing ?
you missed deploying and complete
railways cron scheduler will skip a schedule if there is already a deployment in the active state, at least according to their changelog prom the previous week
I will try it again to be sure then
https://railway.app/changelog/2023-08-11-cron-jobs-generally-available
We now skip job execution if a previous cron is still runningassuming that's true, you would not be able to use cron to restart a discord bot because it would be running when the next job starts, thus getting skipped
i'm just wondering why you would need to restart it. i run probably 10+ discord bots on railway with no performance issues over time
I wasn't gonna open that can of worms
fair
I was still curious though
probably worked for me because the first deployent was from github and then it redeployed from the cron?
no that wouldn't be the case
if you are right and the cron did stop execution of your previously active state deployment then that is a bug
unless you are confusing active with completed
don't understand what you mean for completed but it just redeployed for me
I made some screenshots
one sec
deployments can have many states, one of which would be "completed" this state is for when your app exits with a non error code, and according to the changelog a cron schedule would be skipped if your deployment is not in this state when the schedule is going to run
mine was in "active" state not "completed"
Cron was scheaduled to run at minute 30 of every hour
what kind of app is this
a websocket server
interesting
and why do you restart that?
I dont restart it, i was just testing the cron functionality for @lasse
ah gotcha
I run into some, its in 500 servers. But dont know with yours
ah
okay well obviously the best solution would be to fix the performance issues, if that's out of the question, try railways cron, if that doesn't do it, I have another solution that uses the railway api to restart your service in the form of a template
It's working