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
This commit is contained in:
Matt Aitken
2025-10-22 10:55:05 +01:00
committed by GitHub
parent 3157b657c7
commit 2affe541e8
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -754,8 +754,8 @@ const EnvironmentSchema = z
/** The max number of runs per API call that we'll dequeue in DEV */
DEV_DEQUEUE_MAX_RUNS_PER_PULL: z.coerce.number().int().default(10),
/** The maximum concurrent local run processes executing at once in dev */
DEV_MAX_CONCURRENT_RUNS: z.coerce.number().int().default(25),
/** The maximum concurrent local run processes executing at once in dev. This is a hard limit */
DEV_MAX_CONCURRENT_RUNS: z.coerce.number().int().optional(),
/** The CLI should connect to this for dev runs */
DEV_ENGINE_URL: z.string().default(process.env.APP_ORIGIN ?? "http://localhost:3030"),
@@ -20,7 +20,11 @@ export const loader = createLoaderApiRoute(
environmentId: authentication.environment.id,
dequeueIntervalWithRun: env.DEV_DEQUEUE_INTERVAL_WITH_RUN,
dequeueIntervalWithoutRun: env.DEV_DEQUEUE_INTERVAL_WITHOUT_RUN,
maxConcurrentRuns: env.DEV_MAX_CONCURRENT_RUNS,
// Limit max runs to smaller of an optional global limit and the environment limit
maxConcurrentRuns: Math.min(
env.DEV_MAX_CONCURRENT_RUNS ?? authentication.environment.maximumConcurrencyLimit,
authentication.environment.maximumConcurrencyLimit
),
engineUrl: env.DEV_ENGINE_URL,
});
} catch (error) {