Uh oh!
There was an error while loading. Please reload this page.
perf(webapp): read per-run environment config from the replica at dequeue - #4560
Conversation
|
WalkthroughEnvironment variable retrieval now accepts optional parent-environment and replica-read options. Secret loading selects the replica Prisma client when requested, and environment resolution requests replica reads. Worker runtime-environment lookups select the replica or primary client based on 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
02f6c39 to
323277fCompare
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ueue The managed-worker dequeue resolves each run's environment, organization, and environment variables before starting it. These are stable for the life of a run, so they now read from the control-plane read replica instead of the primary, taking that load off the busiest write path. Falls back to the primary when no replica is configured.
323277f to
c3521aaCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Adds an opt-in path to serve a run's per-run configuration reads from the control-plane read replica instead of the primary, reducing primary database load during task execution. The managed-worker dequeue resolves each run's environment, organization, and environment variables before starting the run; those rows are stable for the life of a run, so they can safely come from the replica.
Gated by
CONTROL_PLANE_DEQUEUE_READS_FROM_REPLICA, defaulting to"0"(reads from the primary, unchanged from today). Set it to"1"to route the reads to the replica. The env-var read is scoped to the dequeue/resolution path (resolveVariablesForEnvironment); dashboard env-var reads and writes always stay on the primary. When no read replica is configured,$replicatransparently falls back to the writer, so single-database self-host is unchanged either way.Verified end-to-end against a real primary/replica split, in both
trigger devand deployed (managed-worker) runs: with the flag on, env vars inject correctly and a value set immediately before triggering a deployed run is present on the run.