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

Asynchronous pruning for RubyThreadPoolExecutor #1082

Open
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 14 times, most recently from c5eca7d to 89b67f4 Compare February 14, 2025 15:54
@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch 10 times, most recently from 57ae7ae to 9164d29 Compare February 14, 2025 23:57
@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch 2 times, most recently from 10f5833 to 76cd713 Compare February 15, 2025 00:22
@joshuay03 joshuay03 changed the title Better pruning for RubyThreadPoolExecutor Asynchronous pruning for RubyThreadPoolExecutor Feb 16, 2025
@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch 12 times, most recently from e50c491 to 547428b Compare February 22, 2025 01:27
@joshuay03 joshuay03 force-pushed the better-ruby-thread-pool-executor-pruning branch from 547428b to a675844 Compare February 22, 2025 01:33
@joshuay03 joshuay03 marked this pull request as ready for review February 22, 2025 01:40
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