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

opt: fix the potential goroutine leak after calling Release() #287

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

ELchem
Copy link
Contributor

@ELchem ELchem commented Jul 5, 2023

…rom Release method


name: Refactor Release Methods
about: Call cleanup functions when Release() is called.
title: ''
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.

By moving stopTicktock and stopPurge into Release() methods from ReleaseTimeout(), these functions will be stopped when Release() is called.

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.

@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

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

Comparison is base (45a0390) 92.46% compared to head (3d949cf) 92.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #287      +/-   ##
==========================================
+ Coverage   92.46%   92.48%   +0.01%     
==========================================
  Files           9        9              
  Lines         770      772       +2     
==========================================
+ Hits          712      714       +2     
  Misses         44       44              
  Partials       14       14              
Flag Coverage Δ
unittests 92.48% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
pool.go 91.25% <100.00%> (+0.03%) ⬆️
pool_func.go 90.12% <100.00%> (+0.04%) ⬆️

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

pool.go Show resolved Hide resolved
pool_func.go Show resolved Hide resolved
@panjf2000 panjf2000 self-assigned this Jul 5, 2023
@panjf2000 panjf2000 added enhancement New feature or request waiting for response waiting for the response from commenter pending development Requested PR owner to improve code and waiting for the result accepted optimization needs fix labels Jul 5, 2023
@panjf2000 panjf2000 changed the title Refactor Release Methods opt: fix the potential goroutine leak after calling Release() Jul 5, 2023
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 2806c4a into panjf2000:dev Jul 6, 2023
13 checks passed
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 needs fix optimization pending development Requested PR owner to improve code and waiting for the result 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