Skip to content

Long runs

By default a run must finish within 30 seconds, and whoever starts it waits for the result. For reports, data syncs and batch jobs, give the script a longer timeout, in seconds, in reminix.json:

{
"slug": "nightly-sync",
"name": "Nightly sync",
"entry": "index.ts",
"timeout": 600,
"inputSchema": { "type": "object", "properties": {} }
}

Long runs are part of the Team and Business plans. A long run lasts at most the version’s timeout or the plan’s longest run, whichever is shorter: 10 minutes on Team, 15 on Business. Its minutes count toward the plan’s long-run minutes for the month (1,000 on Team, 10,000 on Business). See Plans and limits.

It answers at once. Starting a run returns 202 with the run, its status running. In the app you land on the run’s page. The command line (reminix scripts run) follows it to the end. An agent gets the run’s id and reads it later (runs.get).

You can see it working. The run’s page shows its log as it grows, and a progress bar when the code reports progress:

export default async function run(inputs, ctx) {
for (let i = 0; i < pages.length; i++) {
await sync(pages[i]);
ctx.log(`synced page ${i + 1}`);
ctx.progress((i + 1) / pages.length, `Page ${i + 1} of ${pages.length}`);
}
return { pages: pages.length };
}

Through the API, GET /v1/runs/{id} includes progress and progressMessage, and GET /v1/runs/{id}/logs returns the log so far.

You can stop it. Use Cancel run on its page, POST /v1/runs/{id}/cancel, or reminix runs cancel <id>. Whoever started it, the script’s owner, and workspace owners and admins can cancel. The code stops, and the run ends cancelled.

  • A long run executes at most once. It’s never retried automatically, because a retry could repeat what it did, such as sending an email. If it stops unexpectedly, it’s marked failed: interrupted.
  • It has up to 60 seconds of CPU time, which is plenty for code that mostly waits on APIs. Split heavy computation into steps.
  • A workspace runs at most 10 long runs at once. Reminix refuses the 11th with 429 until one finishes.
  • Everything else works as for any run: the network rules, secrets, approvals, schedules and triggers, test runs of drafts, and the run.completed and run.failed events, sent when it ends.