feat(executor): add worker pool and concurrency limit #187
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/ttheart!187
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/add-resource-management"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Add resource management to the command executor:
max_concurrencyconfig option inconfig.yaml(#78)Why
Prevents unbounded goroutine and process spawning under high webhook load. Ensures the server stays responsive even during burst events.
Testing
go test ./...and pre-commit passTestRunCommandConcurrencyLimitBreaking Changes
RunActionssignature changed: addedmaxConcurrency intparameter (pass 0 for default)Notes
max_concurrency: 0in config means "use default" (20)RunActionscall, not global across the applicationCloses #80
Closes #76
Closes #77
Closes #78
Closes #79
Review
Clean worker pool implementation. Full project lint, vet, tests pass.
Design highlights:
make(chan struct{}, maxConcurrency)) — standard Go concurrency patternrunCommand, released after retry loop — slot held for full retry sequenceapplyDefaults(0 or negative → 20)defaultRetryconstant cleaned up (was unused)Models:
Config.MaxConcurrency intwithmax_concurrencyYAML tag. Zero-value = use default.Breaking change:
RunActionssignature extended withmaxConcurrency int. All callers (tests) updated.Non-blocking: Goroutines are still spawned for every rule even when pool is full. They block on the semaphore before executing. This is by design per #79 (non-blocking webhook response). A full worker pool (limiting goroutines too) could be a future enhancement.
No blocking issues.
APPROVED