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

bug: return error before creating multi pools if lbs is invalid to avoid leaks #317

Merged
merged 1 commit into from Mar 26, 2024

Conversation

akshaynanavare
Copy link
Contributor

@akshaynanavare akshaynanavare commented Mar 26, 2024

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

Yes, for small optimization of multi pools.

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

If lbs is invalid then we should immediately return from NewMultiPool func instead of creating pool arrays and then check for lbs validation

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

NA

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

NA

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

…valid

return err before creating multi pools func if lbs is invalid
@akshaynanavare
Copy link
Contributor Author

I think you missed https://github.com/panjf2000/ants/blob/dev/multipool_func.go#L56-L58

@panjf2000 Yes, Added now. Thanks
UT is already there for both of the funcs
If you want explicitly to cover this code, I will add

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.30%. Comparing base (5c07bca) to head (7b5ec33).
Report is 3 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #317   +/-   ##
=======================================
  Coverage   91.30%   91.30%           
=======================================
  Files          11       11           
  Lines         759      759           
=======================================
  Hits          693      693           
  Misses         45       45           
  Partials       21       21           
Flag Coverage Δ
unittests 91.30% <100.00%> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 changed the title return err before creating multi pools if lbs is invalid bug: return error before creating multi pools if lbs is invalid to avoid leaks Mar 26, 2024
@panjf2000 panjf2000 added bug Something isn't working pending merged This PR has been reviewed and approved optimization labels Mar 26, 2024
@panjf2000 panjf2000 merged commit ce28ca1 into panjf2000:dev Mar 26, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working optimization pending merged This PR has been reviewed and approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants