fix(python): reuse tokio runtime instead of creating per call#451
Merged
fix(python): reuse tokio runtime instead of creating per call#451
Conversation
Store a shared `tokio::runtime::Runtime` (current-thread) in PyBash, BashTool, and ScriptedTool structs. Previously each `execute_sync()` and `reset()` call created a new runtime, spawning OS threads that could exhaust thread/fd limits under rapid-fire usage. Fixes #414 https://claude.ai/code/session_01WZjYqxm5xMPAEe7FSHJkDy
c3c0466 to
3ff63a1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tokio::runtime::RuntimeinPyBash,BashTool, andScriptedToolstructsBuilder::new_current_thread()for lighter weight since multi-threaded isn't neededCloses #414
Test plan
execute_sync/reset200 times each on all tool typescargo clippyandcargo fmtpasscargo testpasses