Skip to content

Commit 1bccd1e

Browse files
committed
feat: make gateway fetch timeout configurable
1 parent 56ef39f commit 1bccd1e

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

apps/supervisor/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const Env = z.object({
8080
// Compute settings
8181
COMPUTE_GATEWAY_URL: z.string().url().optional(),
8282
COMPUTE_GATEWAY_AUTH_TOKEN: z.string().optional(),
83+
COMPUTE_GATEWAY_TIMEOUT_MS: z.coerce.number().int().default(30_000),
8384

8485
// Kubernetes settings
8586
KUBERNETES_FORCE_ENABLED: BoolEnv.default(false),

apps/supervisor/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class ManagedSupervisor {
8383
...workloadManagerOptions,
8484
gatewayUrl: env.COMPUTE_GATEWAY_URL,
8585
gatewayAuthToken: env.COMPUTE_GATEWAY_AUTH_TOKEN,
86+
gatewayTimeoutMs: env.COMPUTE_GATEWAY_TIMEOUT_MS,
8687
})
8788
: this.isKubernetes
8889
? new KubernetesWorkloadManager(workloadManagerOptions)

apps/supervisor/src/workloadManager/compute.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { tryCatch } from "@trigger.dev/core";
1111
type ComputeWorkloadManagerOptions = WorkloadManagerOptions & {
1212
gatewayUrl: string;
1313
gatewayAuthToken?: string;
14+
gatewayTimeoutMs: number;
1415
};
1516

1617
export class ComputeWorkloadManager implements WorkloadManager {
@@ -92,7 +93,7 @@ export class ComputeWorkloadManager implements WorkloadManager {
9293
fetch(url, {
9394
method: "POST",
9495
headers,
95-
signal: AbortSignal.timeout(30_000),
96+
signal: AbortSignal.timeout(this.opts.gatewayTimeoutMs),
9697
body: JSON.stringify({
9798
image: imageRef,
9899
env: envVars,

0 commit comments

Comments
 (0)