-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix(worker): do not premature kill threads when not exiting #47
fix(worker): do not premature kill threads when not exiting #47
Conversation
7a741d3
to
56dc199
Compare
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.
approved for #53 review.
56dc199
to
1a03dd9
Compare
1a03dd9
to
12d74f6
Compare
@bungle @chronolaw can we merge this now? |
e37554c
to
5fb3f1d
Compare
9d7e392
to
681cac7
Compare
ngx.shared.dict:set("broker-pid", ngx.worker.pid()) | ||
end | ||
|
||
if id == 0 or id == 1 then |
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.
How about the id == 2
? The broker itself also receive the event.
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.
@outsinre, broker runs on id=2
, see (and in this test I am not interested in broker as that is what is about to crash and hard to make it with current design reliable):
https://github.com/Kong/lua-resty-events/pull/47/files#diff-f8f62b1b0529d11f96be1a1f25b7f11df85ce86fb864528bd0d623f14bf22278R23
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.
Yes, worker 0 and worker 1 will output debug logs for testing.
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.
I just wonder if we should test broker's output as well.
Since broker is down in this test case, it is OK without it.
There are some commented code in test case, I suggest to remove them before it merged. |
681cac7
to
d570fd7
Compare
@chronolaw, It is left for further enhancements, when we get them done. Not to be removed (I added comment about it). |
d570fd7
to
2af6d7e
Compare
ngx.shared.dict:set("broker-pid", ngx.worker.pid()) | ||
end | ||
|
||
if id == 0 or id == 1 then |
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.
Yes, worker 0 and worker 1 will output debug logs for testing.
### Summary - fix(tests): fix tests to not be order dependent on multi-worker scenario (Kong#46) - chore(callback): remove unnecessary assert when the type is already checked (Kong#50) - chore(queue): rename DEFAULT_QUEUE_LEN to more meaningful MAX_QUEUE_PREALLOCATE (Kong#52) - chore(callback): split get_callback_list to two functions to avoid unnecessary table creation (Kong#51) - fix(worker): do not premature kill threads when not exiting (Kong#47) - fix(broker): do not premature kill threads when not exiting (Kong#48) - fix(worker): separate communication and event processing to different timers (Kong#53) - caused by Kong#47
### Summary - fix(tests): fix tests to not be order dependent on multi-worker scenario (Kong#46) - chore(callback): remove unnecessary assert when the type is already checked (Kong#50) - chore(queue): rename DEFAULT_QUEUE_LEN to more meaningful MAX_QUEUE_PREALLOCATE (Kong#52) - chore(callback): split get_callback_list to two functions to avoid unnecessary table creation (Kong#51) - fix(worker): do not premature kill threads when not exiting (Kong#47) - fix(broker): do not premature kill threads when not exiting (Kong#48) - fix(worker): separate communication and event processing to different timers (Kong#53) - caused by Kong#47
### Summary - fix(tests): fix tests to not be order dependent on multi-worker scenario (Kong#46) - chore(callback): remove unnecessary assert when the type is already checked (Kong#50) - chore(queue): rename DEFAULT_QUEUE_LEN to more meaningful MAX_QUEUE_PREALLOCATE (Kong#52) - chore(callback): split get_callback_list to two functions to avoid unnecessary table creation (Kong#51) - fix(worker): do not premature kill threads when not exiting (Kong#47) - fix(broker): do not premature kill threads when not exiting (Kong#48) - fix(worker): separate communication and event processing to different timers (Kong#53) - caused by Kong#47
### Summary - fix(tests): fix tests to not be order dependent on multi-worker scenario (#46) - chore(callback): remove unnecessary assert when the type is already checked (#50) - chore(queue): rename DEFAULT_QUEUE_LEN to more meaningful MAX_QUEUE_PREALLOCATE (#52) - chore(callback): split get_callback_list to two functions to avoid unnecessary table creation (#51) - fix(worker): do not premature kill threads when not exiting (#47) - fix(broker): do not premature kill threads when not exiting (#48) - fix(worker): separate communication and event processing to different timers (#53) - caused by #47
KAG-4480