R
Railway6mo ago
Cnikel

Scheduled rebooting memory leak

Hi, it would be nice with scheduled rebooting if possible to combat memory leak in backend. Yes it's not optimal to have a memory leak but it's a very small leak I'm trying to debug in the meantime I want to reboot the backend once a day.
Solution:
this template was made with your exact use case in mind - https://railway.app/template/fwH-l3...
Jump to solution
17 Replies
Percy
Percy6mo ago
Project ID: N/A
Brody
Brody6mo ago
thanks for sharing your usecase!
Solution
Brody
Brody6mo ago
this template was made with your exact use case in mind - https://railway.app/template/fwH-l3
Cnikel
CnikelOP6mo ago
thanks
Brody
Brody6mo ago
let me know if you run into any difficulties
Cnikel
CnikelOP6mo ago
Hi, I tested this out but for me it did not work as planned it's a bit hard to debug because I don't know what part I've done wrong I think it would make more sense in your instructions to put the "deploy this template" first because it I put the schedule_1 and stuff like that in my other service
jeremy
jeremy6mo ago
you could also do it in code. I'm also doing a restart once a day with a cron job node+nestjs
@Cron('0 8 * * *', {
timeZone: constants.worker.timezones.iceland,
})
async restart() {
await this.railwayService.restart(RailwayServices.api);
}

restart() {
await this.axiosService.post<Deployments>(this.config.url, {
headers: {
Authorization: `Bearer ${this.config.apiKey}`,
'Content-Type': 'application/json',
},
data: {
query: `
mutation DeploymentRestart($id: String!) {
deploymentRestart(id: $id)
}
`,
variables: { id },
},
});
}
@Cron('0 8 * * *', {
timeZone: constants.worker.timezones.iceland,
})
async restart() {
await this.railwayService.restart(RailwayServices.api);
}

restart() {
await this.axiosService.post<Deployments>(this.config.url, {
headers: {
Authorization: `Bearer ${this.config.apiKey}`,
'Content-Type': 'application/json',
},
data: {
query: `
mutation DeploymentRestart($id: String!) {
deploymentRestart(id: $id)
}
`,
variables: { id },
},
});
}
Brody
Brody6mo ago
this is exactly what the service I made does. have you read the templates overview? https://railway.app/template/fwH-l3 I thought I did a pretty good job at explaining every little detail needed to deploy it
Cnikel
CnikelOP6mo ago
seems to work now as a railway beginner i didn't understand you had to deploy the template
Brody
Brody6mo ago
uhhh well i would have never imagined id need to tell you to deploy the template can you help me understand the thought process behind being able to use a template without ever deploying it?
Cnikel
CnikelOP6mo ago
I don't know I must be stupid i thought I would make it myself by following the text and skip the template I never used CRON before so this might add to the confusion. I followed everything in the text, I put the schedule_1 and token on my service variables for the thing I wanted to restart anyway I don't think there is much to improve in the instructions, it comes from inexperience with both railway and cron on my side
Brody
Brody6mo ago
sounds good, so you did get it to work in the end?
Cnikel
CnikelOP6mo ago
yes
Brody
Brody6mo ago
awsome, and i always wanna hear peoples usecase for it, would you mind sharing? same as this threads title?
Cnikel
CnikelOP6mo ago
ye
Brody
Brody6mo ago
cool, thanks for sharing
Cnikel
CnikelOP6mo ago
thanks
Want results from more Discord servers?
Add your server