Skip to content

Commit 2affe54

Browse files
authored
Dev concurrency limit by env (with optional global limit) (#2625)
* Limit local dev concurrency using the dev environment concurrency limit Previously it was limited to max of 25, no matter the environment limit * Have global dev limit
1 parent 3157b65 commit 2affe54

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

apps/webapp/app/env.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,8 @@ const EnvironmentSchema = z
754754
/** The max number of runs per API call that we'll dequeue in DEV */
755755
DEV_DEQUEUE_MAX_RUNS_PER_PULL: z.coerce.number().int().default(10),
756756

757-
/** The maximum concurrent local run processes executing at once in dev */
758-
DEV_MAX_CONCURRENT_RUNS: z.coerce.number().int().default(25),
757+
/** The maximum concurrent local run processes executing at once in dev. This is a hard limit */
758+
DEV_MAX_CONCURRENT_RUNS: z.coerce.number().int().optional(),
759759

760760
/** The CLI should connect to this for dev runs */
761761
DEV_ENGINE_URL: z.string().default(process.env.APP_ORIGIN ?? "http://localhost:3030"),

apps/webapp/app/routes/engine.v1.dev.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ export const loader = createLoaderApiRoute(
2020
environmentId: authentication.environment.id,
2121
dequeueIntervalWithRun: env.DEV_DEQUEUE_INTERVAL_WITH_RUN,
2222
dequeueIntervalWithoutRun: env.DEV_DEQUEUE_INTERVAL_WITHOUT_RUN,
23-
maxConcurrentRuns: env.DEV_MAX_CONCURRENT_RUNS,
23+
// Limit max runs to smaller of an optional global limit and the environment limit
24+
maxConcurrentRuns: Math.min(
25+
env.DEV_MAX_CONCURRENT_RUNS ?? authentication.environment.maximumConcurrencyLimit,
26+
authentication.environment.maximumConcurrencyLimit
27+
),
2428
engineUrl: env.DEV_ENGINE_URL,
2529
});
2630
} catch (error) {

0 commit comments

Comments
 (0)