-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Avoid spawning Threadpool#trim
thread if pool size is fixed
#3384
Avoid spawning Threadpool#trim
thread if pool size is fixed
#3384
Conversation
80a764b
to
97baf4e
Compare
auto_trim_time = 3 | ||
server_run(min_threads: 2, max_threads: 2, auto_trim_time: auto_trim_time) | ||
sleep 1 # wait for possible initial trim on run | ||
thread_pool_expect false, :trim, nil, after: auto_trim_time |
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.
@rus-max Ah I did not see that, thanks! I'll leave this open cause I took a different approach with the tests. I'll add @OuYangJinTing as a co-author if the maintainers choose to go with this PR. |
97baf4e
to
fed4d4a
Compare
fed4d4a
to
60d3de6
Compare
Co-authored-by: ouyangjinting <OuYangJinTing@users.noreply.github.com>
60d3de6
to
e556608
Compare
That was really sweet that you both added each other as co-author ❤️ I like the tests on this one a bit more, so I'll go with this one. |
Description
While working on #3383 I found that a thread was being spawned to trim the server's thread pool's threads every
:auto_trim_time
seconds regardless of whether or not the pool needed trimming, which would only be when the thread count is configured to scale automatically i.e. min != max.This PR ensures that specific thread is only spawned if the thread count is not fixed.
Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.