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

Better pruning for RubyThreadPoolExecutor #1082

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joshuay03
Copy link

@joshuay03 joshuay03 commented Feb 8, 2025

Closes #1066
Closes #1075

Alternative to #1079

Implementation is based on the discussion in the linked issues.

@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch 15 times, most recently from b6e5656 to f90d46d Compare February 9, 2025 04:23
@@ -114,9 +120,9 @@ def worker_task_completed
synchronize { @completed_task_count += 1 }
end

# @!macro thread_pool_executor_method_prune_pool
def prune_pool
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This public API no longer makes sense now that the pruning is automatic. It seems it was only added because of the Ruby thread pool's synchronous pruning, which the Java version didn't suffer from, hence why it's a no-op there.

@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch 9 times, most recently from d599b89 to a80fa75 Compare February 9, 2025 08:38
@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch from a80fa75 to 0b7f573 Compare February 9, 2025 09:00
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.

CachedThreadPool does not spin down idle threads Unexpected pruning behaviour with consecutive task batches
1 participant