-
Notifications
You must be signed in to change notification settings - Fork 21
Refactor Connection Config #97
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
base: main
Are you sure you want to change the base?
Refactor Connection Config #97
Conversation
b76e0e5 to
381cf3a
Compare
Pangjiping
left a comment
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.
lgtm
33b95c0 to
a11a972
Compare
Pangjiping
left a comment
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.
LGTM
07d99ce to
48f875f
Compare
48f875f to
1bec8a7
Compare
Pangjiping
left a comment
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.
lgtm
|
@codex review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1bec8a7e83
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dispatcher = new Agent({ | ||
| keepAliveTimeout: DEFAULT_KEEPALIVE_TIMEOUT_MS, | ||
| keepAliveMaxTimeout: DEFAULT_KEEPALIVE_TIMEOUT_MS, | ||
| }); |
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.
Add cleanup for per-config undici Agent
The new createNodeFetch allocates a dedicated undici Agent per ConnectionConfig, but the SDK doesn’t expose any way to close/destroy that agent. In long‑lived Node processes that create and discard many Sandbox/Manager instances, these per‑config pools can leave sockets/timers around until process exit. This is a new resource‑leak risk compared to using the global fetch. Consider wiring a close hook (e.g., on manager/sandbox close) or reusing a shared agent so these pools can be released.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| function normalizeDomainBase(input: string): { protocol?: ConnectionProtocol; domainBase: string } { | ||
| const DEFAULT_KEEPALIVE_TIMEOUT_MS = 15_000; |
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.
Sure about this default value? It's not consistent with SDK default keep-alive is 30 seconds for its own pools. mentioned in REAME.md
| private val logger = LoggerFactory.getLogger(HttpClientProvider::class.java) | ||
|
|
||
| private val connectionPool = | ||
| config.connectionPool ?: ConnectionPool(32, 15, TimeUnit.SECONDS) |
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.
Better to extract 15 to constant and also has the same inconsistency problem with README.md

Summary
Ensured separate connection pools are allocated for each sandbox/manager instance, even when using a singleton ConnectionConfig.
Updated several connection pool settings.
Testing
Breaking Changes
Checklist