Skip to content

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

Merged
panjf2000 merged 1 commit into
panjf2000:devfrom
akshaynanavare:feature/optimize-multipool
Mar 26, 2024
Merged

panjf2000 merged 1 commit into
panjf2000:devfrom
akshaynanavare:feature/optimize-multipool

Conversation

@akshaynanavare

@akshaynanavare akshaynanavare commented Mar 26, 2024 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Owner

…valid

return err before creating multi pools func if lbs is invalid
@akshaynanavare
akshaynanavare force-pushed the feature/optimize-multipool branch from 9ede250 to 7b5ec33 Compare March 26, 2024 10:24
@akshaynanavare

Copy link
Copy Markdown
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

@codecov

codecov Bot commented Mar 26, 2024 •

Copy link
Copy Markdown

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.

@panjf2000 panjf2000 left a comment

Copy link
Copy Markdown
Owner

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
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.

2 participants

⌂ 换网址