Skip to content

feat(health-check): bound cron sweep to time budget + resumable checkpointing (#1152) - #1207

Closed
ayomidearegbeshola29-dev wants to merge 1 commit into
StellerCraft:mainfrom
ayomidearegbeshola29-dev:fix/health-check-cron-execution-budget-and-checkpointing
Closed

feat(health-check): bound cron sweep to time budget + resumable checkpointing (#1152)#1207
ayomidearegbeshola29-dev wants to merge 1 commit into
StellerCraft:mainfrom
ayomidearegbeshola29-dev:fix/health-check-cron-execution-budget-and-checkpointing

Conversation

@ayomidearegbeshola29-dev

Copy link
Copy Markdown
Contributor

Bound the health-check sweep to the cron execution budget + add resumable checkpointing (#1152)

Summary

Closes #1152

apps/backend/src/app/api/cron/health-check/route.ts calls
HealthMonitorService.checkAllDeployments(), which fans out (via pMap) across
every active deployment with no upper bound and no way to resume if the
platform's cron execution limit is hit mid-sweep. A truncated run currently
restarts from the beginning next time, leaving some deployments unchecked.

Changes

  • HealthMonitorService.checkAllDeployments(opts?) now accepts an optional
    { cursor, limit }. When limit is supplied it pages the underlying query
    (ordered by id) and returns { results, nextCursor, truncated }, so a
    truncated run can resume from nextCursor instead of restarting.
  • Added HEALTH_CHECK_SWEEP_BUDGET_MS (30s) as the documented execution-time
    budget
    . Callers can size limit to stay under it for very large accounts.
  • The no-argument call path is unchanged (still returns the flat array), so the
    existing route and all current callers keep working.

Test

health-check.budget.integration.test.ts (new) mocks Supabase + fetch and:

  1. Asserts a sweep over 2,000 deployments completes within
    HEALTH_CHECK_SWEEP_BUDGET_MS.
  2. Asserts the paged API resumes correctly: page 1 (limit: 500) reports
    truncated: true + nextCursor, and page 2 returns a disjoint set of
    deployment ids (no overlap, no restart-from-beginning).

This complements the companion concurrency-cap fix (the unbounded Promise.all
is now a bounded, resumable paged sweep).

closes #1152

@ayomidearegbeshola29-dev

Copy link
Copy Markdown
Contributor Author

Closing as duplicate — ayomidearegbeshola29-dev PR #1190 already covers #1151/#1152. Keeping #1190.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bound the Health-Check Sweep to Fit Within the Cron Execution Time Budget

1 participant