Skip to content

Add timeout support for JavaScript evaluation - #4

Merged
Valian merged 3 commits into
Valian:mainfrom
bradleygolden:improved-orca-02312b
Jan 6, 2026
Merged

Add timeout support for JavaScript evaluation#4
Valian merged 3 commits into
Valian:mainfrom
bradleygolden:improved-orca-02312b

Conversation

@bradleygolden

Copy link
Copy Markdown
Contributor

Add optional timeout parameter to eval/2 and eval/3 that interrupts long-running JavaScript code.

bradleygolden and others added 3 commits December 30, 2025 10:14
Add optional timeout parameter to eval/2 and eval/3 that interrupts
long-running JavaScript code. Uses QuickJS interrupt handler with
monotonic clock to detect when deadline is exceeded.

- Add deadline_ms field to JsContext struct
- Implement interrupt handler that checks deadline on each tick
- Update nif_eval to accept timeout_ms parameter (0 = no timeout)
- Update nif_run for callbacks with timeout support
- Return {:error, :timeout} when execution exceeds deadline
- Ensure deadline resets between calls for context reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Valian
Valian merged commit 17f4388 into Valian:main Jan 6, 2026
@bradleygolden
bradleygolden deleted the improved-orca-02312b branch January 7, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants