feat(health-check): bound cron sweep to time budget + resumable checkpointing (#1152) - #1207
Closed
ayomidearegbeshola29-dev wants to merge 1 commit into
Conversation
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tscallsHealthMonitorService.checkAllDeployments(), which fans out (viapMap) acrossevery 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 }. Whenlimitis supplied it pages the underlying query(ordered by
id) and returns{ results, nextCursor, truncated }, so atruncated run can resume from
nextCursorinstead of restarting.HEALTH_CHECK_SWEEP_BUDGET_MS(30s) as the documented execution-timebudget. Callers can size
limitto stay under it for very large accounts.existing route and all current callers keep working.
Test
health-check.budget.integration.test.ts(new) mocks Supabase +fetchand:HEALTH_CHECK_SWEEP_BUDGET_MS.limit: 500) reportstruncated: true+nextCursor, and page 2 returns a disjoint set ofdeployment ids (no overlap, no restart-from-beginning).
This complements the companion concurrency-cap fix (the unbounded
Promise.allis now a bounded, resumable paged sweep).
closes #1152