Cron job - run overlaps but next is not skipped
mstrchng
PROOP

15 days ago

Hello,

Cron job runs are overlapping. Expecting the next run to be skipped if a run is still running.

According to https://docs.railway.com/guides/cron-workers-queues:

"No guarantee of execution order; if a run overlaps, the next is skipped"

Any ideas?

Solved

3 Replies

Railway
BOT

15 days ago

The next run is skipped only when the previous run's deployment is still in the Active state at the moment the next execution is due, per our cron docs. When runs overlap without a skip, it means the prior deployment is no longer marked Active (its process exited or the deployment completed) even though work is still in flight, so the scheduler sees nothing running and starts the next one.


Status changed to Awaiting User Response Railway 15 days ago


Railway

The next run is skipped only when the previous run's deployment is still in the `Active` state at the moment the next execution is due, per our [cron docs](https://docs.railway.com/cron-jobs). When runs overlap without a skip, it means the prior deployment is no longer marked `Active` (its process exited or the deployment completed) even though work is still in flight, so the scheduler sees nothing running and starts the next one.

mstrchng
PROOP

15 days ago

Deployment is in Active state at the moment the next execution is due


Status changed to Awaiting Railway Response Railway 15 days ago


sam-a
EMPLOYEE

15 days ago

You're correct, and this isn't something in your setup. Our docs describe the next run being skipped while a previous execution is still running, but that skip isn't currently happening. When a previous run is still in progress at the next scheduled time, we start the new run anyway instead of skipping it, so the runs overlap. What you're seeing matches that gap on our side, not your cron configuration. For now, the only reliable way to prevent overlap is to guard against concurrent runs inside the job itself (for example, a lock or an "already running" check) until the skip behavior matches what the docs describe.


Status changed to Awaiting User Response Railway 15 days ago


Railway
BOT

8 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 8 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...