Parent: #1970
Goal
Replace minute-cron round-robin execution with horizontally scalable, site-scoped asynchronous dispatch for provisioning, imports, publication routes, and recovery.
Current limitation
The scheduled handler chooses one configured site per minute and performs at most one heavyweight operation or one publication route. With N sites, each site receives one turn every N minutes; multi-route readiness grows linearly with fleet size.
Architecture
- Enqueue immutable operation and publication work after the owning D1/R2 commit.
- Use Cloudflare Queues or an equivalent declared executor with at-least-once delivery.
- Keep D1 operation claims, coordinator leases, prepared commit identity, and immutable R2 publication receipts authoritative for exactly-once effects.
- Partition concurrency by site while allowing unrelated sites to execute in parallel.
- Apply global and per-principal backpressure, retry budgets, dead-letter evidence, and bounded runtime memory.
- Retain cron only for reconciliation, orphan recovery, due WordPress events, and queue repair.
Acceptance criteria
- Ten unrelated site provisions can make progress concurrently without waiting for round-robin cron turns.
- Duplicate, delayed, reordered, and concurrently delivered messages converge without duplicate WordPress commits or publication promotion.
- One site retains at most one active canonical mutation while publication work uses immutable revision identities.
- A failed or evicted PHP-WASM isolate leaves durable retryable work and the previous publication readable.
- Queue saturation produces explicit backpressure rather than unbounded work or silent loss.
- Dead-letter and reconciliation paths link site, operation, attempt, input digest, revision, and exact recovery command.
- Complete local integration gates cover operation-first/publication-first fairness, retry, stale claims, supersession, and cold restart.
- No deployment is performed by this issue.
Related
AI assistance
OpenAI GPT-5.6 Sol via OpenCode traced the current scheduled handler and drafted the queue/exactly-once-effects contract with Chris Huber.
Parent: #1970
Goal
Replace minute-cron round-robin execution with horizontally scalable, site-scoped asynchronous dispatch for provisioning, imports, publication routes, and recovery.
Current limitation
The scheduled handler chooses one configured site per minute and performs at most one heavyweight operation or one publication route. With N sites, each site receives one turn every N minutes; multi-route readiness grows linearly with fleet size.
Architecture
Acceptance criteria
Related
AI assistance
OpenAI GPT-5.6 Sol via OpenCode traced the current scheduled handler and drafted the queue/exactly-once-effects contract with Chris Huber.