Skip to content

Function interval schedules (and restrict cron to Pro+) #14170

Closed
1 of 1 issue completed
Closed

Description

@ChiragAgg5k

Add first-class interval schedules for functions so free users get a platform-chosen cadence (min every hour) instead of arbitrary crons, make intervals the recommended path for everyone, and gate custom cron to Pro+.

Plan

Goal: Reduce keep-alive abuse and top-of-hour load by replacing free-plan cron with interval schedules (platform picks the minute), while Pro keeps cron as an advanced option behind a clear Recommend tag on intervals.

Current footprint:

  • Schedules are cron-only strings today: platform schedules collection (schedule attr) in app/config/collections/platform.php; mirrored on the function doc (schedule / scheduleId) in projects.php. Written from Functions/Create.php / Update.php via Appwrite\Task\Validator\Cron.
  • Scheduler path: ScheduleFunctions → Schedule\Source\Functions builds new Shifted(new Cron(...), offset). Utopia already ships Trigger\Interval (epoch-anchored grid) but nothing wires it for functions yet.
  • Levi’s spread (partial fix for hourly bunching only): #13121 / #13122 (_APP_FUNCTIONS_SCHEDULE_SPREAD + overridable spreadWindow); shared in #13172. Cloud override spreads free/education only, paid stay exact: cloud ScheduleFunctions.php. Does not stop * * * * * keep-alive or change what users may set.
  • Plan gates: plans.php caps free at 2 functions / 750k executions / 100 GBHours; no schedule/cron feature flag today. Pro feature pattern exists (e.g. backups.enabled).
  • Console UI is cron-only: legacy updateSchedule.svelte + inputCron.svelte; vibes CronScheduleEditor.tsx presets map to cron (every-minute → * * * * *, etc.).
  • Counts/savings: unknown from repo — no free-cron inventory in code/docs. Measure via platform DB: join active schedules (resourceType=function, active=true) to teams on free/education and bucket by expression (* * * * *, */5, 0 * * * *, …). Cost drivers: billed executions + GBHours (usage.php: $2/1M exec, $0.06/GB-hour for paid overage; free is included quota identity spend) plus warm-runtime / cold-start herd that Levi’s spread only partially softens.

Remaining steps:

  1. Interval schedule feature — Add schedule type (cron | interval) + interval seconds on function/schedule docs; wire Trigger\Interval in Schedule\Source\Functions with a platform-chosen anchor/minute (stable per function id, same spirit as crc32 spread) so free min interval = 3600s and runs do not bunch. API + SDK + validator; reject free intervals < 1h.
  2. Gate new crons to Pro+ — Cloud: refuse schedule cron creates/updates for free/education (grandfather existing until migration); expose plan flag (mirror backups.enabled). Self-hosted stays unrestricted.
  3. Console UX — Vibes + legacy: interval picker as default with Recommend tag; demote cron to Advanced/Pro. Drop or hide free-tier presets denser than hourly.
  4. Migration estimate (then optional email) — Query free active function crons → map each to closest allowed interval → estimate monthly exec/GBHour reduction vs status quo; only then decide mass email + auto-migrate.

Risks:

  • Grandfathering vs forced migrate: breaking existing free * * * * * without notice.
  • Interval anchor choice must survive restarts (Interval already does) and stay stable when users change only the period.
  • SDK/docs still document cron-as-only schedule; dual-write during rollout.
  • Savings number needs a prod query before committing to email/migration effort.

Done when:

  • Free users can create interval schedules (≥ 1h) with platform-chosen phase; cannot create new cron schedules
  • Pro+ can still set cron; Console highlights intervals (Recommend) for all plans
  • Scheduler dispatches intervals via Trigger\Interval (not cron-emulation)
  • Written estimate of free-cron → interval savings (or documented why not worth migrating)
  • Docs/SDK updated; Levi spread remains for any remaining shared cron slots on free

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. self-assigned this
    on Oct 6, 2026
  2. added
    product / auth
    product / avatars
    product / console
    product / databases
    product / functions
    product / messaging
    product / migrations
    product / sites
    product / storage
    product / vcs
    on Oct 6, 2026
  3. ChiragAgg5k commented on Oct 14, 2026

    @ChiragAgg5k
    MemberAuthor

    Released in Appwrite 2.5.0 (includes #14309).

  4. ChiragAgg5k commented on Oct 19, 2026

    @ChiragAgg5k
    MemberAuthor

    Step 2 (cron gate re-land, appwrite-labs/cloud#6636) released in cloud 1.51.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

product / authproduct / avatarsproduct / consoleproduct / databasesproduct / functionsproduct / messagingproduct / migrationsproduct / sitesproduct / storageproduct / vcs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions