-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor: refine the code in retrieveWorker
to make it more readable
#295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also apply the same changes in pool_func.go
All done. @panjf2000 |
Above done. @panjf2000 |
Done. @panjf2000 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #295 +/- ##
==========================================
+ Coverage 92.48% 94.08% +1.59%
==========================================
Files 9 9
Lines 772 744 -28
==========================================
- Hits 714 700 -14
+ Misses 44 32 -12
+ Partials 14 12 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
… directly below p.Cap().
Done. @panjf2000 |
retrieveWorker
to make it more readable.
retrieveWorker
to make it more readable.retrieveWorker
to make it more readable
Thank you for your contribution! |
name: Pull request
about: Propose changes to the code
title: 'make func of retrieveWorker() more readable.'
labels: ''
assignees: ''
1. Are you opening this pull request for bug-fixs, optimizations or new feature?
refactor
2. Please describe how these code changes achieve your intention.
I noticed that when I call
retrieveWorker()
, it processes two repetitive functions:detach()
andcapacity == -1 || capacity > p.Running()
in theelse
block.Thus, I move the
retry
label to the first instance of thedetach()
function and made a little change of if-else block.It didn't affect the logic, but it is more readable.
before
after
3. Please link to the relevant issues (if any).
No
4. Which documentation changes (if any) need to be made/updated because of this PR?
No
4. Checklist