Skip to content

Commit 29feeff

Browse files
committed
Configure the waitUntil timeout via an env var
1 parent d5e7158 commit 29feeff

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ const EnvironmentSchema = z
12321232
REALTIME_STREAMS_S2_FLUSH_INTERVAL_MS: z.coerce.number().int().default(100),
12331233
REALTIME_STREAMS_S2_MAX_RETRIES: z.coerce.number().int().default(10),
12341234
REALTIME_STREAMS_S2_WAIT_SECONDS: z.coerce.number().int().default(60),
1235-
WAIT_UNTIL_TIMEOUT_MS: z.coerce.number().int().default(60_000),
1235+
WAIT_UNTIL_TIMEOUT_MS: z.coerce.number().int().default(600_000),
12361236
})
12371237
.and(GithubAppEnvSchema)
12381238
.and(S2EnvSchema);

apps/webapp/app/v3/environmentVariables/environmentVariablesRepository.server.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,14 @@ async function resolveCommonBuiltInVariables(
11851185
String(env.TRIGGER_OTEL_ATTRIBUTE_PER_EVENT_COUNT_LIMIT)
11861186
),
11871187
},
1188+
{
1189+
key: "TRIGGER_WAIT_UNTIL_TIMEOUT_MS",
1190+
value: resolveBuiltInEnvironmentVariableOverrides(
1191+
"TRIGGER_WAIT_UNTIL_TIMEOUT_MS",
1192+
runtimeEnvironment,
1193+
String(env.WAIT_UNTIL_TIMEOUT_MS)
1194+
),
1195+
},
11881196
];
11891197
}
11901198

packages/cli-v3/src/entryPoints/managed-run-worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ const standardRealtimeStreamsManager = new StandardRealtimeStreamsManager(
140140
);
141141
realtimeStreams.setGlobalManager(standardRealtimeStreamsManager);
142142

143-
const waitUntilManager = new StandardWaitUntilManager();
143+
const waitUntilTimeoutInMs = getNumberEnvVar("TRIGGER_WAIT_UNTIL_TIMEOUT_MS", 60_000);
144+
const waitUntilManager = new StandardWaitUntilManager(waitUntilTimeoutInMs);
144145
waitUntil.setGlobalManager(waitUntilManager);
145146

146147
const standardHeartbeatsManager = new StandardHeartbeatsManager(

references/realtime-streams/src/trigger/streams.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const streamsTask = task({
113113

114114
const mockStream = createStreamFromGenerator(generator);
115115

116-
await streams.append("stream", mockStream);
116+
const { wait } = await streams.append("stream", mockStream);
117117

118118
await setTimeout(1000);
119119

@@ -128,6 +128,8 @@ export const streamsTask = task({
128128
tokenCount++;
129129
}
130130

131+
await wait();
132+
131133
logger.info("Stream completed", { scenario, tokenCount });
132134

133135
return {

0 commit comments

Comments
 (0)