Bound capability call's max concurrency#2074
Conversation
|
👋 justinkaseman, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
✅ API Diff Results -
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a per-execution concurrency bound for asynchronous host calls (capability calls and secrets retrieval) made from WASM workflows, to avoid unbounded goroutine growth and backpressure these operations when the limit is reached.
Changes:
- Add
ModuleConfig.MaxPendingCallswith a default value and wire it into module creation/execution. - Introduce a per-execution semaphore and use it to bound concurrency in
callCapAsyncandgetSecretsAsync. - Update tests that directly construct
executionto initialize the new semaphore field.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
pkg/workflows/wasm/host/module.go |
Adds MaxPendingCalls config/defaulting and initializes the per-execution semaphore. |
pkg/workflows/wasm/host/execution.go |
Uses the semaphore to cap concurrent goroutines for capability/secrets async calls. |
pkg/workflows/wasm/host/module_test.go |
Initializes pendingCallsSem in a concurrency-related test execution instance. |
pkg/workflows/wasm/host/execution_await_order_test.go |
Initializes pendingCallsSem in await-ordering test execution instance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| if modCfg.MaxPendingCalls == 0 { | ||
| modCfg.MaxPendingCalls = defaultMaxPendingCalls |
There was a problem hiding this comment.
Worth being a uint maybe?
There was a problem hiding this comment.
This doesn't add cleanly with the ResourcePoolLimiter. We would have to cast it everywhere.
I'll just add the guard.
6cead5b to
b932fc6
Compare
No description provided.