-
Notifications
You must be signed in to change notification settings - Fork 3.3k
improvement(functions): increase function block timeout to 3 min #1641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
Increased function execution timeout from 5-10 seconds to 3 minutes (180s) across all execution paths to support longer-running user code
Key Changes:
- Route handler:
maxDuration60s → 300s, defaulttimeout5s → 180s - Function handler: default timeout 5s → 180s
- Tool config:
DEFAULT_TIMEOUT10s → 180s
Issues Found:
- Critical:
maxDuration(300s) exceeds executiontimeout(180s), creating a 2-minute gap where the route stays open but execution has timed out
Confidence Score: 3/5
- This PR has a configuration mismatch that needs to be resolved before merging
- The changes correctly increase timeouts consistently across the codebase, but there's a logical error where
maxDuration(300s) is set higher than the executiontimeout(180s). This means functions will timeout at 3 minutes but the API route stays open for 5 minutes, potentially causing confusing behavior or resource waste. - apps/sim/app/api/function/execute/route.ts -
maxDurationandtimeoutvalues need alignment
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/api/function/execute/route.ts | 5/5 | Increased maxDuration from 60s to 300s (5 min) and default timeout from 5s to 180s (3 min) |
| apps/sim/executor/handlers/function/function-handler.ts | 5/5 | Increased default timeout fallback from 5s to 180s (3 min) |
| apps/sim/tools/function/execute.ts | 5/5 | Updated DEFAULT_TIMEOUT constant from 10s to 180s (3 min) |
Sequence Diagram
sequenceDiagram
participant Client
participant API as /api/function/execute
participant Handler as FunctionBlockHandler
participant Tool as functionExecuteTool
participant VM as Execution Environment
Note over API: maxDuration: 300s (5 min)
Client->>Handler: Execute function block
Handler->>Tool: executeTool('function_execute')
Note over Handler: timeout: 180000ms (3 min)
Tool->>API: POST /api/function/execute
Note over Tool: DEFAULT_TIMEOUT: 180000ms
API->>API: Parse request body
Note over API: Default timeout: 180000ms
alt E2B Execution (Remote)
API->>VM: executeInE2B(code, timeout)
Note over VM: Cloud sandbox execution
VM-->>API: Result/Error
else Local VM Execution
API->>VM: script.runInContext(timeout)
Note over VM: Node.js VM execution
VM-->>API: Result/Error
end
API-->>Tool: Response (success/error)
Tool-->>Handler: CodeExecutionOutput
Handler-->>Client: Execution result
3 files reviewed, 1 comment
|
1 Job Failed: CI / Test and Build / Test and Build failed on "Build application" |
Summary
Function block timeout for native and remote code execution increased to 3 min.
Type of Change
Testing
Manually
Checklist