Repository navigation
feat: implement ReleaseContext for all pool types - #387
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #387 +/- ##
==========================================
+ Coverage 94.54% 94.66% +0.12%
==========================================
Files 14 14
Lines 788 863 +75
==========================================
+ Hits 745 817 +72
- Misses 32 33 +1
- Partials 11 13 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new ReleaseContext(ctx context.Context) error shutdown API across the pool types, enabling graceful pool release that can be canceled/abandoned via a shared context (e.g., with http.Server.Shutdown), addressing feature request #384.
Changes:
- Add
ReleaseContexttopoolCommon(and expose it via the package-level default pool API). - Add
ReleaseContextto multi-pool variants (MultiPool,MultiPoolWithFunc,MultiPoolWithFuncGeneric), delegating to underlying pools and aggregating per-pool errors. - Add tests covering default pool and multi-pool
ReleaseContextbehavior (including a nil-context case).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
ants.go |
Adds ReleaseContext for the default pool and implements (*poolCommon).ReleaseContext. |
multipool.go |
Adds (*MultiPool).ReleaseContext that releases all sub-pools concurrently and aggregates errors. |
multipool_func.go |
Adds (*MultiPoolWithFunc).ReleaseContext with the same pattern as ReleaseTimeout. |
multipool_func_generic.go |
Adds (*MultiPoolWithFuncGeneric).ReleaseContext with the same pattern as ReleaseTimeout. |
ants_test.go |
Adds test coverage for ReleaseContext on default pool, nil context behavior, and multi-pool variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #384