Define Instance

marcus1688
PROOP

21 days ago

Hi, i got three instance and any variable you guys provided to define first instance, second instance and third instance? the issue i facing now is, i running cron job in my code but if i got three instance it will run the cron job three time, this is not the things i want. How should i make sure the cron job only run on first instance instaed of three?

Solved$10 Bounty

8 Replies

Railway
BOT

21 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


sarahkb125
EMPLOYEE

21 days ago

Hi there, can you please share a link to the project you're experiencing issues with, and ideally a screenshot?


Status changed to Awaiting User Response Railway 21 days ago


marcus1688
PROOP

21 days ago

you can check the record for this project. at first i use 3 instanace but all my cron job calculation x3, i already change back to 1 instance


Status changed to Awaiting Railway Response Railway 21 days ago


21 days ago

For your use case, you would want to break out the cron job into its own service.

I will open this thread up to the community so that they can help you with the implementation.


Status changed to Awaiting User Response Railway 21 days ago


21 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 21 days ago


marcus1688
PROOP

21 days ago

are you stupid? i put private you simply put public without my concern?


marcus1688
PROOP

21 days ago

fuck you railway


21 days ago

If a thread contains no PII and does not require an employee's assistance, we may make the thread public.

https://docs.railway.com/reference/support#private-threads


Status changed to Awaiting User Response Railway 21 days ago


monuit
PROTop 10% Contributor

21 days ago

hey, you can implement this using railway's function method which can automatically run your cron jobs, you can read up on it here

alternatively, you can split your existing service into another worker service with node, looking like:

// worker/index.js

const cron = require('node-cron');

cron.schedule('*/5 * * * *', async () => {

console.log('cron tick');

// do work

});

process.stdin.resume(); // keep process alive if needed

you'd have to assign it a different start command, which can be found here on how to implement

Attachments


Status changed to Awaiting Railway Response Railway 21 days ago


Status changed to Solved brody 21 days ago


Loading...