Skip to content

Commit 3ec1c52

Browse files
committed
address timeouts
1 parent 651f02a commit 3ec1c52

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

sandbox-sidecar/src/runners/e2bRunner.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,16 @@ export class E2BSandboxRunner implements SandboxRunner {
193193
logger.warn({ templateId, engine, version }, "no pre-built template found, will install at runtime");
194194
}
195195

196-
logger.info({ templateId }, "creating E2B sandbox");
196+
// Extend sandbox lifetime to 30 minutes for long-running benchmarks
197+
// Default is 5 minutes which isn't enough for large terraform applies
198+
const sandboxTimeoutSeconds = 30 * 60; // 30 minutes
199+
200+
logger.info({ templateId, timeoutSeconds: sandboxTimeoutSeconds }, "creating E2B sandbox");
197201
const sandbox = await Sandbox.create(templateId, {
198202
apiKey: this.options.apiKey,
203+
timeoutMs: sandboxTimeoutSeconds * 1000,
199204
});
200-
logger.info({ sandboxId: sandbox.sandboxId }, "E2B sandbox created");
205+
logger.info({ sandboxId: sandbox.sandboxId }, "E2B sandbox created with extended timeout");
201206

202207
// Store engine metadata for command execution
203208
(sandbox as any)._requestedEngine = engine;
@@ -361,11 +366,16 @@ export class E2BSandboxRunner implements SandboxRunner {
361366
appendLog?.(chunk);
362367
};
363368

369+
// Use long timeout for benchmarks (30 minutes) - some operations like 10k resources take a while
370+
// Set to 0 to disable timeout entirely if needed
371+
const timeoutMs = 30 * 60 * 1000; // 30 minutes
372+
364373
const result = await sandbox.commands.run(cmdStr, {
365374
cwd,
366375
envs: this.buildTerraformEnvs(metadata),
367376
onStdout: pipeChunk,
368377
onStderr: pipeChunk,
378+
timeoutMs,
369379
});
370380

371381
const stdout = result.stdout;

0 commit comments

Comments
 (0)