Skip to content

feat(controller): wire GC scheduling to controller#2020

Open
mitchhs12 wants to merge 2 commits intomainfrom
mitchhs12/scheduler-wiring
Open

feat(controller): wire GC scheduling to controller#2020
mitchhs12 wants to merge 2 commits intomainfrom
mitchhs12/scheduler-wiring

Conversation

@mitchhs12
Copy link
Contributor

@mitchhs12 mitchhs12 commented Mar 24, 2026

Summary

  • Adds GcSchedulingConfig (enabled/interval) to amp-config with TOML deserialization and JSON schema
  • Adds locations_with_expired_entries() pre-filter query to metadata-db — single query returns only locations that need GC
  • Adds schedule_gc_jobs() to controller scheduler:
    • Skips locations that already have an in-flight job (deduplication)
    • Skips locations where the last job completed recently (throttling)
    • Records metrics for jobs dispatched, skipped-in-flight, and skipped-too-recent
  • Spawns background scheduling task in controller service, disabled by default (gc_scheduling.enabled = false)
  • 4 scheduler integration tests: pre-filter validation, deactivated revision handling, in-flight dedup, recently-completed throttle

Context

This is PR 3 of 3 splitting up the GC job extraction work:

  1. amp-worker-gc crate (merged in feat(amp-worker-gc): add standalone GC job crate #2009)
  2. Wire to worker service (merged in feat(worker): wire GC job type to worker and admin-api #2010)
  3. This PR — wire to scheduler + config + scheduler tests

Add GC job scheduling to the controller service. The controller
periodically sweeps for locations with expired gc_manifest entries and
dispatches GC jobs to workers via the job ledger.

- Add GcSchedulingConfig (enabled/interval) to amp-config
- Add locations_with_expired_entries() pre-filter query to metadata-db
- Add schedule_gc_jobs() to controller scheduler with dedup, throttling,
  and per-location metrics
- Spawn background scheduling task in controller service (disabled by default)
- Add 4 scheduler integration tests (pre-filter, deactivated revisions,
  in-flight dedup, recently-completed throttle)
…iring

# Conflicts:
#	crates/config/src/lib.rs
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.

1 participant