Skip to content
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

feat: add a new API ReleaseTimeout for the default pool #281

Merged
merged 2 commits into from
Jun 30, 2023
Merged

feat: add a new API ReleaseTimeout for the default pool #281

merged 2 commits into from
Jun 30, 2023

Conversation

ELchem
Copy link
Contributor

@ELchem ELchem commented Jun 28, 2023


name: Unblock goPurge and goTicktock in defaultAntsPool
about: ants.Release() calls defaultAntsPool.Release() which leaves goPurge and goTicktock still running in the background. ants.Release() should close the context for goPurge and goTicktock. This can be accomplished by calling defaultAntsPool.ReleaseTimeout().
title: 'Unblock goPurge and goTicktock in defaultAntsPool'
labels: ''
assignees: ''

1. Are you opening this pull request for bug-fixs, optimizations or new feature?

Bug-fix.

2. Please describe how these code changes achieve your intention.

goPurge and goTicktock are left on the stack because there is no way to close those methods started by the defaultAntsPool. This PR should add a fix for that.

3. Please link to the relevant issues (if any).

#244

4. Which documentation changes (if any) need to be made/updated because of this PR?

4. Checklist

  • I have squashed all insignificant commits.
  • I have commented my code for explaining package types, values, functions, and non-obvious lines.
  • I have written unit tests and verified that all tests passes (if needed).
  • I have documented feature info on the README (only when this PR is adding a new feature).
  • (optional) I am willing to help maintain this change if there are issues with it later.

@panjf2000
Copy link
Owner

We should add a new API like ReleaseTimeout instead of modifying an existing one.

@panjf2000 panjf2000 self-requested a review June 28, 2023 13:26
@panjf2000 panjf2000 self-assigned this Jun 28, 2023
@panjf2000 panjf2000 added waiting for response waiting for the response from commenter pending development Requested PR owner to improve code and waiting for the result labels Jun 28, 2023
@ELchem
Copy link
Contributor Author

ELchem commented Jun 29, 2023

I added a function called ReleaseTimeout() to ants.go. Is that what you had in mind?

Copy link
Owner

@panjf2000 panjf2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some new test cases for this new API.

@panjf2000 panjf2000 changed the title Unblock goPurge and goTicktock in defaultAntsPool feat: add a new API ReleaseTimeout for the default pool Jun 29, 2023
@panjf2000 panjf2000 added enhancement New feature or request pending merged This PR has been reviewed and approved accepted new feature labels Jun 29, 2023
ants_test.go Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 🎉

Comparison is base (7be597c) 92.44% compared to head (e1a126e) 92.46%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #281      +/-   ##
==========================================
+ Coverage   92.44%   92.46%   +0.01%     
==========================================
  Files           9        9              
  Lines         768      770       +2     
==========================================
+ Hits          710      712       +2     
  Misses         44       44              
  Partials       14       14              
Flag Coverage Δ
unittests 92.46% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
ants.go 86.36% <100.00%> (+1.36%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Owner

@panjf2000 panjf2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks~

@panjf2000 panjf2000 merged commit b3f3a38 into panjf2000:master Jun 30, 2023
13 checks passed
panjf2000 added a commit that referenced this pull request Jun 30, 2023
@panjf2000
Copy link
Owner

I did not check carefully before, we've changed the default branch from master to dev, you should open a pull request aginst dev, not master, reverting it.

@panjf2000
Copy link
Owner

Please open a new pull request to branch dev when you have time, sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted enhancement New feature or request new feature pending development Requested PR owner to improve code and waiting for the result pending merged This PR has been reviewed and approved waiting for response waiting for the response from commenter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants