Skip to main content

cron

Lets the project schedule Bots to run on a timer. A Bot with a cronString or cronTiming element is registered to run on that schedule.

TypeProject feature
Value in featurescron
Change withPATCH /v1/projects/me/features (replaces the whole list)
Who can change itProject admin. Any practitioner can read the list.
On for new projectsYes
Needsbots as well
When offA scheduled Bot saves, but nothing is scheduled. There is no error.

What it enables​

When a Bot is created or updated, Ovok registers its schedule if the Bot has a cronString or a cronTiming and the project has cron. At each tick the Bot runs as if it had been executed by id, so it needs bots too. For the shape of cronTiming, see Timing.

Turn it on​

Add cron to the list and send the whole list. Include bots, or the schedule will fire and be refused.

curl --request PATCH \
--url 'https://api.sandbox.ovok.com/v1/projects/me/features' \
--header "Authorization: Bearer ${OVOK_TOKEN}" \
--header 'Content-Type: application/json' \
--data '{"features":["bots","cron","email","transaction-bundles","websocket-subscriptions"]}'

What happens when it is off​

Nothing visible. Saving a Bot with a schedule returns success, and no job is registered, so the Bot never runs on its own. No endpoint tells you that the schedule was ignored.

Gotchas​

  • The schedule is registered when the Bot is saved, not when it fires. Turning cron on does not schedule Bots you saved earlier. Save each one again to register it.
  • Turning cron off does not stop schedules that already exist. They keep firing while bots is on. To stop a scheduled Bot, remove its schedule and save it, or delete the Bot.
  • cron alone runs nothing. Without bots, each tick is refused with Bots not enabled.
  • A silent miss is the failure mode. If a scheduled Bot is not running, check the features list first, then re-save the Bot.
  • Projects created before this was a default can lack it. Call GET /v1/projects/me/features and check.