Release lock for interruptable client requests#237
Release lock for interruptable client requests#237mishushakov wants to merge 13 commits intomainfrom
Conversation
PR SummaryMedium Risk Overview
Written by Cursor Bugbot for commit dfc32d2. This will update automatically on new commits. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| // This simulates a client disconnect: the SDK aborts the connection, | ||
| // which should trigger the server to interrupt the kernel (#213). | ||
| await expect( | ||
| sandbox.runCode('import time; time.sleep(30)', { timeoutMs: 3_000 }) |
There was a problem hiding this comment.
make this longer than test timeout, so we're sure it was cancelled
| sandbox.runCode('import time; time.sleep(30)', { timeoutMs: 3_000 }) | |
| sandbox.runCode('import time; time.sleep(300)', { timeoutMs: 3_000 }) |
| '@e2b/code-interpreter-template': patch | ||
| --- | ||
|
|
||
| release lock before stream completion |
| # This simulates a client disconnect: the SDK closes the connection, | ||
| # which should trigger the server to interrupt the kernel (#213). | ||
| with pytest.raises(TimeoutException): | ||
| await async_sandbox.run_code("import time; time.sleep(30)", timeout=3) |
There was a problem hiding this comment.
| await async_sandbox.run_code("import time; time.sleep(30)", timeout=3) | |
| await async_sandbox.run_code("import time; time.sleep(300)", timeout=3) |
| # This simulates a client disconnect: the SDK closes the connection, | ||
| # which should trigger the server to interrupt the kernel (#213). | ||
| with pytest.raises(TimeoutException): | ||
| sandbox.run_code("import time; time.sleep(30)", timeout=3) |
There was a problem hiding this comment.
| sandbox.run_code("import time; time.sleep(30)", timeout=3) | |
| sandbox.run_code("import time; time.sleep(300)", timeout=3) |
| while True: | ||
| output = await queue.get() | ||
| try: | ||
| output = await asyncio.wait_for(queue.get(), timeout=KEEPALIVE_INTERVAL) |
There was a problem hiding this comment.
could you add the comment above with explanation for the keepalive interval 🙏🏻

fixes #213