RAILWAY_REPLICA_NUMBER to easily identify a replica
chandrika
EMPLOYEEOP

10 months ago

Railway offers a RAILWAY_REPLICA_ID variables

It would be helpful for certain use cases if there was also a RAILWAY_REPLICA_NUMBER where it would just have [0,1,2] for say three replicas

Under Review

0 Threads mention this feature

2 Replies

daxelrod
PRO

10 months ago

Would be super helpful for our cron processes. Currently our cron is embedded in our main server application and if we could have this then we wouldn't need to rip it out to an entirely separate service. We could just have if (replica_number === 0) {cron_runner()}.


echohack
EMPLOYEE

9 months ago

Hey daxelrod, is your app a leader-follower topology? IE: Replica 0 is the leader, 1/2 followers? (In other words, if 0 goes down, you want 1/2 to pick up the cron). Or are you simply wanting to always target one of the replicas and put your cron there? Is there leader election to consider here?


Loading...