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

Invoke decRunning() when revertWorker() returns false #51

Merged
merged 1 commit into from
Sep 12, 2019

Conversation

choleraehyq
Copy link
Contributor

@choleraehyq choleraehyq commented Sep 11, 2019

Signed-off-by: Cholerae Hu choleraehyq@gmail.com


name: Pull request
about: Propose changes to the code
title: ''
labels: ''
assignees: ''

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

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

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

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.

@choleraehyq
Copy link
Contributor Author

@panjf2000

@codecov
Copy link

codecov bot commented Sep 11, 2019

Codecov Report

Merging #51 into master will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #51      +/-   ##
==========================================
- Coverage    95.5%   95.45%   -0.06%     
==========================================
  Files           5        5              
  Lines         356      352       -4     
==========================================
- Hits          340      336       -4     
  Misses         10       10              
  Partials        6        6
Impacted Files Coverage Δ
worker.go 100% <100%> (ø) ⬆️
worker_func.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 280ac34...6495acc. Read the comment docs.

@panjf2000
Copy link
Owner

@choleraehyq
这个 bug 我理解了,不过麻烦更新一下 PR,把worker_func.go也一并 fix 了,谢谢~

@panjf2000 panjf2000 changed the title worker: decRunning when revertWorker is false Invoke decRunning() when revertWorker() returns false Sep 11, 2019
@choleraehyq
Copy link
Contributor Author

@panjf2000 done

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.

有时间看下我的 comment

worker_func.go Outdated Show resolved Hide resolved
@panjf2000
Copy link
Owner

@choleraehyq
Unit tests 失败了

@panjf2000
Copy link
Owner

看了下代码,应该是 worker 的 defer 体中的

w.pool.decRunning()
w.pool.workerCache.Put(w)

还没执行完成而TestPanicHandler就已经在验证了:

if p1.Running() != 0 {
	t.Errorf("pool should be empty after panic")
}

从而导致了报错。

Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
@choleraehyq
Copy link
Contributor Author

@panjf2000 done

@panjf2000
Copy link
Owner

Fixed #50

@panjf2000 panjf2000 merged commit d6cd5a7 into panjf2000:master Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants