Presets for the usual
Every 1, 5, 10, 15 or 30 seconds, every few minutes or hours, every day, working days, every month or every year.
API Maker
The framework for AI era
Your code
Run your code on a timetable, once per cluster, without a cron server.
A scheduler is TypeScript plus one or more intervals: every few seconds, every day at midnight, or your own cron. With several servers, one process owns each scheduler through a Redis lock, so every run happens once. If that server goes down, another one takes over.
Step through it, slow it down, or open the full canvas.
A scheduler is your code and its intervals. Write TypeScript with g, add one or more intervals and press Ctrl + S. It is compiled and saved: no cron server to set up.
Write TypeScript with g, add one or more intervals and press Ctrl + S. It is compiled and saved: no cron server to set up.
From every 5 seconds to every year, or your own cron with seconds. Each interval has its time zone and can be switched off.
Every process tries to pick schedulers under a Redis lock. The first one starts the jobs and marks the scheduler running, so each run happens once in the cluster.
The owner runs your code in its sandbox with the scheduler timeout, 10 minutes by default, and saves the log of each run. It refreshes its Redis key every minute.
Its key is not refreshed and expires after 75 seconds. A check every minute marks the scheduler as not running, and another process picks it up, a pickup runs every 5 minutes.
The owner stops its jobs, a run in progress finishes, and the scheduler is picked up again 5 seconds later with the new code. No redeploy.
Every 1, 5, 10, 15 or 30 seconds, every few minutes or hours, every day, working days, every month or every year.
Write your own cron expression with seconds. A scheduler can have several intervals, each with its time zone and an on/off switch.
Processes pick schedulers under a Redis lock. The owner runs them and refreshes its claim every minute.
When the owner stops refreshing its claim, it expires and another process picks the scheduler up.
Query and update any database, call external APIs, emit events and use your utility classes, like in a custom API.
Runs appear in the logs like API calls, with their output or error when the log profile saves them.
Expire old carts, send a daily sales report by email, sync prices from a supplier API every 15 minutes. Each one is a scheduler in API Maker, versioned with the rest of your project and deployed with it.
import * as T from 'types';async function main(g: T.IAMGlobal) { const dayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000); const result = await g.sys.db.updateMany({ instance: 'mongodb', database: 'shop', collection: 'carts', find: { status: 'open', updatedAt: { $lt: dayAgo } }, updateData: { status: 'expired' }, }); g.logger.log(`${result.updatedRowsCount} carts expired`);}module.exports = main;Interval: every day, at midnight, Asia/Kolkata. Press Ctrl + S and it is scheduled.
The run in progress finishes. The scheduler is then picked up again with the new code: no restart, no deployment.
Yes. Switch the scheduler off, or switch off one of its intervals.
In the sandbox of the process that owns it, or on the native process when you allow it.
Documentation