Skip to content

Commit 659efbf

Browse files
feat(webapp): expose debounce fast-path/quantization knobs as env vars
Per Devin Review: the previous PR threaded only `useReplicaForFastPathRead` from the env. `quantizeNewDelayUntilMs` and `fastPathSkipEnabled` were hardcoded to their RunEngine defaults, so operators couldn't tune or disable them without a code change. Adds: - `RUN_ENGINE_DEBOUNCE_QUANTIZE_NEW_DELAY_UNTIL_MS` (default 1000ms, 0 to disable) - `RUN_ENGINE_DEBOUNCE_FAST_PATH_SKIP_ENABLED` (default "1", set to "0" as a kill-switch if the fast-path needs to be disabled in production without a redeploy) Co-Authored-By: Eric Allam <eallam@icloud.com>
1 parent 5cca5f2 commit 659efbf

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

apps/webapp/app/env.server.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,21 @@ const EnvironmentSchema = z
666666
.int()
667667
.default(60_000 * 60), // 1 hour
668668

669+
/**
670+
* Bucket size in milliseconds used to quantize the newly computed `delayUntil`
671+
* in the debounce system. Quantization collapses concurrent triggers on the
672+
* same hot debounce key onto the same target time so the unlocked fast-path
673+
* skip is effective. Set to 0 to disable. Default: 1000ms (1s).
674+
*/
675+
RUN_ENGINE_DEBOUNCE_QUANTIZE_NEW_DELAY_UNTIL_MS: z.coerce.number().int().min(0).default(1000),
676+
677+
/**
678+
* Whether the unlocked fast-path skip is enabled in the debounce system.
679+
* Acts as a kill switch in case the fast-path needs to be disabled in
680+
* production without a redeploy. Default: "1" (enabled).
681+
*/
682+
RUN_ENGINE_DEBOUNCE_FAST_PATH_SKIP_ENABLED: z.string().default("1"),
683+
669684
RUN_ENGINE_WORKER_REDIS_HOST: z
670685
.string()
671686
.optional()

apps/webapp/app/v3/runEngine.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ function createRunEngine() {
214214
// Debounce configuration
215215
debounce: {
216216
maxDebounceDurationMs: env.RUN_ENGINE_MAXIMUM_DEBOUNCE_DURATION_MS,
217+
quantizeNewDelayUntilMs: env.RUN_ENGINE_DEBOUNCE_QUANTIZE_NEW_DELAY_UNTIL_MS,
218+
fastPathSkipEnabled: env.RUN_ENGINE_DEBOUNCE_FAST_PATH_SKIP_ENABLED === "1",
217219
useReplicaForFastPathRead: env.RUN_ENGINE_DEBOUNCE_USE_REPLICA_FOR_FAST_PATH_READ === "1",
218220
},
219221
});

0 commit comments

Comments
 (0)