-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: add test for effect of UV_THREADPOOL_SIZE #49165
test: add test for effect of UV_THREADPOOL_SIZE #49165
Conversation
Review requested:
|
This (not particularly elegant) native addon tests the effect of UV_THREADPOOL_SIZE on node-api. The test fails if Node.js allows more than UV_THREADPOOL_SIZE async tasks to run concurrently, or if it limits the number of concurrent async tasks to anything less than UV_THREADPOOL_SIZE.
25ac64c
to
c8edfb7
Compare
This comment was marked as resolved.
This comment was marked as resolved.
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.
Really good work. Thanks!
cc @nodejs/cpp-reviewers @nodejs/libuv |
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.
LGTM
This works perfectly. I've tested it with the |
Landed in 556e95a |
This (not particularly elegant) native addon tests the effect of UV_THREADPOOL_SIZE on node-api. The test fails if Node.js allows more than UV_THREADPOOL_SIZE async tasks to run concurrently, or if it limits the number of concurrent async tasks to anything less than UV_THREADPOOL_SIZE. PR-URL: #49165 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
This (not particularly elegant) native addon tests the effect of
UV_THREADPOOL_SIZE
on node-api. The test fails if Node.js allows more thanUV_THREADPOOL_SIZE
async tasks to run concurrently, or if it limits the number of concurrent async tasks to anything less thanUV_THREADPOOL_SIZE
.The test schedules
UV_THREADPOOL_SIZE + 1
async tasks and waits untilUV_THREADPOOL_SIZE
tasks are running concurrently. (If this never happens, the test times out.) AllUV_THREADPOOL_SIZE
tasks then wait for a second to see if the last task also starts running concurrently, which should not happen.Admittedly, I hastily put this together and the code is sloppy. While having this test is good in any case, the main motivation is such that @anonrig can invoke the test from his own test in #48890.