- A short task calls a page of your app on a schedule. The work runs inside your web server, so it must be quick.
- A long task runs a command, such as
npm run sitemaps, on its own machine until it finishes. It uses the same code, variables and database as your app, without taking memory or time from your web server.
Which type to use
Use a short task for work that takes seconds or a few minutes: a cleanup, a sync, a reminder. Use a long task for anything that takes longer, needs more memory than your web server has, or should not slow your web server down.
Coming from Heroku Scheduler
A long task runs your command with
/bin/sh -c, so &&, pipes and $VARIABLES work as they do in a terminal. Your image needs a shell: an image built without one (a distroless image) cannot run a long task, and the run says so.
Adding a job
New job opens the job’s page. A job has a name, a type, a command (long task) or a page to call (short task), and a schedule.- The page to call is a path on your app’s address, which the form shows in front of it. It starts with
/and uses only letters, digits,-,_and/. A query string is not sent. - The command is one line. It is stored and shown as written, so never put a secret in it. Read secrets from your app’s variables, for example
$SHOPIFY_API_SECRET. - The schedule, in UTC, is a preset (every 10 minutes for a short task, hourly at a minute you choose, daily at a time you choose) or a custom cron expression with five fields. The form shows the next three runs, and refuses an expression that is not valid.
Long tasks
A long task runs the version of your app that is live when the run starts, with the variables, secrets and database your web server has at that moment. After a deploy the next run uses the new version, and after a rollback it uses the version you rolled back to. A run in progress keeps the version it started with. The job’s page says Runs the version deployed on with the date, and each run shows the commit it ran. Before your first deploy, a long task has nothing to run: the page says Runs after your first deploy, and a run that is due is skipped. These limits are fixed. They are not settings.- One run at a time. A run that is due while the previous run of the same job is still going is skipped, and the history says Skipped: previous run still running.
- A run is stopped after 12 hours.
- A run is never retried. A failed run waits for its next scheduled time, or for Run now.
- 1 vCPU and 1 GB of memory for each run, or 2 GB with pack L, whatever the size of your web server.
Long-task hours
Long tasks use hours. Scheduler includes 5 hours a month. A pack adds its hours to those 5:
An app has one pack at most. Choose or change it with Add hours on the Scheduler page. A larger pack is charged now for the rest of the month, and gives its extra hours for the rest of the month in the same proportion. A smaller pack applies at your next renewal, so you keep the hours and the memory you paid for until then.
How the hours are counted:
- A run counts from the moment its machine starts to the moment it ends, to the second.
- Failed runs, runs that ran out of memory, runs stopped at 12 hours and runs you stopped yourself count for the time they ran.
- Skipped runs and runs Meridian stopped (because the app was paused, or the job or the add-on was removed) count for nothing.
- The hours belong to the app. Runs in every environment use the same hours, and the hours card shows the split, such as “Production 52 h, Staging 6 h”.
Run history
The list shows each job’s last run and how it ended. The job’s page shows its last 10 runs, with when each started, whether it was scheduled or started manually, how long it took and how it ended:- Succeeded.
- Failed, with the exit code of a long task or the HTTP status of a short task.
- Command not found: the shell did not find the command of a long task (exit code 127).
- Crashed: a signal ended the command of a long task. The exit code is 128 plus the signal, so 139 is a segmentation fault. A runtime that stops at its own heap limit ends this way: Node does at about 500 MB unless you raise it with
--max-old-space-size, well below the memory of the run. - Timed out: a short task did not answer in time, or a long task reached 12 hours.
- Ran out of memory: a long task used more memory than its run has. Pack L gives runs 2 GB.
- Skipped, with the reason: the previous run was still going, no hours were left, the app was paused, or nothing was deployed yet.
- Stopped, by a member or by Meridian.
logs_tail and source: "task".
A short task’s runs are read from Cloud Scheduler every few minutes, so a job that runs more often than that shows its latest run of each reading, not every one.
The organization’s owners get one email when a job starts failing, and one when it succeeds again. There is nothing to set up, and no email for each failed run in between.
Running a job now
Run now, on the job’s page, runs the job at once without changing its schedule. A paused job cannot be run. Resume it first. For a short task, Meridian asks Cloud Scheduler to send exactly the request a scheduled run sends, with the same token and header. The button shows Running… while Meridian waits for the attempt, then the result, with a link to the environment’s live logs. If the attempt has not ended after 30 seconds, Meridian says the job is still running: check the logs. For a long task, Run now starts a run exactly as its schedule would: it uses your hours, appears in the history as Started manually, and is refused while a run of the job is in progress or when no hours are left. Stop, next to a run in progress, ends it. The time it ran still counts.A job’s state
The list shows each job’s state as Cloud Scheduler reports it, not only the last thing you asked for:- Active: the job runs on its schedule.
- Paused: Cloud Scheduler confirmed the pause.
- Disabled: Cloud Scheduler turned the job off after an error.
- Update failed: Cloud Scheduler could not apply the last change to the job.
- Missing: Cloud Scheduler has no job under this name. The job cannot run, pause or resume. Delete it and create it again.
How a short task calls your app
Meridian sends aPOST to the job’s path. Two things prove the request came from Meridian:
- An OIDC token issued for your environment’s invoker service account, audienced to your app’s base URL. This is the primary proof of origin, and it is what the platform checks.
- An
X-Meridian-Cron-Secretheader, whose value matches theCRON_SECRETenvironment variable injected into your app. Compare the two in your handler if you want a check inside your own code.
CRON_SECRET is stored in the secret store and injected at deploy time. You never set it yourself, and its value is never shown back to you.
Your app must answer within the environment’s request timeout, and never later than 30 minutes. A request that takes longer is recorded as Timed out. It is not sent again: the job waits for its next scheduled time. Write the handler to be idempotent all the same, since a schedule can fire while a previous run is still going.
Job limits
The number of jobs is a limit counted per app, across all its environments, and short and long tasks share it: the 5 jobs Scheduler includes, plus 5 for each Scheduler jobs pack. Buy packs from Add capacity on the app’s billing page, where they sit inside the Scheduler card. They are sold only to an app that has Scheduler, and removing Scheduler ends them on the same date. When you are at the limit, adding a job is refused with the limit and your current usage. Delete a job or add a pack. Removing Scheduler deletes its jobs, stops any long task that is running, and ends the long-task pack on the same date. When Scheduler setup fails, Delete Scheduler on the Scheduler screen removes it at once and stops billing for it, so you can enable it again. It needs the Hosting: Delete permission and asks you to confirm.Scheduler can only be enabled once your production environment exists. A short task added before your first successful deployment will call an app that isn’t serving yet, and a long task waits for that deployment.