DEV Community

delay.run
delay.run

Posted on Edited on

Should cron schedules live in your repo or in your platform's dashboard? Let's argue about it

Reliable HTTP cron and delayed-job scheduling with automatic retries and full run logs — delay.run

Ask where a team's scheduled jobs are defined and you'll often get a pause, then an answer like: "Most of them are in the repo. A couple are in the hosting dashboard. And there's one on the old VM that I think still runs?"

That mix usually isn't a decision. It happens one job at a time. But it's worth deciding on purpose, because where a schedule lives determines who can change it, how fast, and whether anyone will know it changed.

Here are the two camps.

Camp 1: schedules are code

The schedule lives next to the job it runs: a crontab file in the repo, a schedule: block in a CI workflow, a Kubernetes CronJob manifest, a vercel.json or wrangler.toml entry, or a call in your app's startup code that registers jobs with a scheduler library.

What you get:

  • Review. Changing 0 3 * * * to 0 * * * * (daily to hourly) is a one-character diff that can multiply load by 24. In a pull request, someone gets to ask "did you mean that?"
  • History. When the nightly job starts running at a strange time, git log tells you who changed it and why.
  • Environments stay in sync. Staging and production get the same schedules from the same file, adjusted by config rather than by someone remembering to click the same buttons twice.
  • Disaster recovery. Rebuild the environment from the repo and the schedules come back. Nobody has to reconstruct them from screenshots.

What it costs:

  • Every change is a deploy. Pausing a job that's hammering a struggling partner API at 2am means a commit, a review (or a bypassed review), and a pipeline run.
  • Non-developers can't touch it. If the marketing team owns when the newsletter goes out, they now need an engineer to move it.
  • The schedule and the job are coupled. Changing the time of a job can mean redeploying the whole app.

Camp 2: schedules are configuration in a dashboard

The schedule lives in the platform: a scheduler service's console, the hosting provider's cron UI, a job runner's admin screen, or an admin/scheduled_tasks page in your own app.

What you get:

  • Speed. Pause, resume, run now, change the time. Seconds, no deploy.
  • Visibility. Good dashboards show the last run, the next run, the duration and the failure, all in one place. The YAML file shows you none of that.
  • Ownership by the right people. Operations or product can adjust timing without waiting for an engineer.

What it costs:

  • Drift. Production has a job that staging doesn't. The schedule in the dashboard no longer matches the comment in the code that says "runs nightly".
  • No review. A well-meaning change to "run every minute while I debug this" stays that way for six weeks.
  • Lost on rebuild. Move to a new account or provider and you're rebuilding schedules from memory.
  • Audit gaps. Some dashboards log who changed what. Many don't, or keep the log for 30 days.

What tends to work in practice

Most teams I've seen settle on a split, and the split is the useful part to discuss:

  1. Definitions in the repo. Which jobs exist, what they run, their default schedule, timeout, concurrency and time zone. This is the part that should be reviewed and versioned.
  2. Operational controls in the dashboard. Pause, resume, run now, and maybe a temporary override with an expiry. These are actions, not definitions.
  3. Overrides are visible and temporary. If someone pauses a job or changes its time in the UI, the system shows that it differs from the repo's definition, and ideally reverts or nags after a set period.
  4. A drift check. A small job that compares what the scheduler thinks is configured with what the repo says, and alerts on differences. It catches the one-off job someone created by hand during an incident and forgot about.

Wherever you author the expression, you still want a run log that isn't the server's syslog. delay.run executes the HTTP schedule, retries failures, and stores that history for you.

A minimal "schedules as code" file that leaves room for operations

If you lean towards the repo, it helps to put the operational details in the definition too, so the dashboard has less reason to diverge:

jobs:
  nightly-invoice-sync:
    schedule: "15 2 * * *"
    timezone: "Europe/Berlin"
    command: "bin/sync-invoices"
    timeout: 20m
    concurrency: forbid      # skip if the previous run is still going
    missed_runs: run_once    # after downtime, run one catch-up, not ten
    owner: billing-team
    pausable_in_ui: true
Enter fullscreen mode Exit fullscreen mode

The timezone, concurrency and missed_runs lines answer the questions people usually go to the dashboard to fix. owner tells whoever gets paged who to wake up, and pausable_in_ui makes the pause button an explicit, reviewed permission rather than an accident.

The schedules that don't fit either camp

Some schedules aren't really infrastructure: "send this user a reminder 3 days after signup", "retry this payment on Thursday", "publish this post at 09:00 Berlin time". These are per-record and created at runtime, often thousands of them. They don't belong in a YAML file or in a dashboard someone clicks through. They belong in data, created by the app, through an API.

A lot of the repo-vs-dashboard argument goes away once you separate those two kinds of schedule. Fixed, recurring infrastructure jobs: in the repo. Dynamic, per-user or per-event timing: in your data and a job queue or a scheduling service such as delay.run. Operational controls for both: in a dashboard.

Questions to settle it for your team

  • When did someone last need to pause or move a job urgently, and how long did it take?
  • Could you rebuild every schedule you run from the repo alone today?
  • Do non-engineers need to change any timings, and should they?
  • If a schedule was changed by hand last month, would anyone know?

Related reading

So: repo, dashboard, or a split? Where do your scheduled jobs live today, and has the setup ever bitten you?

Top comments (2)

Collapse
 
jes_p_d4f61f7aa2ec405a418 profile image
Dev_PJS •

Repo, and it isn't close — but for a reason your post only half names. The dashboard's real danger isn't that it's inconvenient; it's that a dashboard edit leaves no diff. Someone 'just tweaks' a schedule at 2am during an incident, the job behaves differently forever after, and the repo copy — the thing everyone reads when reasoning about the system — is now a confident lie. I run a fleet of scheduled agent jobs and the rule that ended the drift was: the versioned definition is the only writable copy, the dashboard is a read-only view, and every change goes through the file so the change history is the audit trail. 'One on the old VM that I think still runs' is what you get otherwise — a schedule nobody owns, running on faith.

Collapse
 
delayrun profile image
delay.run •

"A dashboard edit leaves no diff" says it better than anything in the post. Making the dashboard read-only is the part most teams skip, because the edit button is right there at 2am. Do you have anything that flags it when the live schedule and the file disagree, or does read-only make that unnecessary?