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

Name the thread pools #96

Merged
merged 1 commit into from
Aug 25, 2020
Merged

Conversation

sj26
Copy link
Contributor

@sj26 sj26 commented Aug 25, 2020

Before, threads had names like "worker-1" in Thread.list and friends, and Notifier could not be differentiated from Scheduler, or other concurrent-ruby ThreadPoolExecutor instances:

  Thread #<Thread:0x00007fee3fc4d418@worker-1 /usr/local/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:332 sleep> status=sleep priority=0
      /usr/local/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/good_job-1.2.1/lib/good_job/notifier.rb:93:in `wait_for_notify'

Now, the class name is used as a default thread pool name, which is prefixes to worker names:

  Thread #<Thread:0x00007fee3fc4d418@GoodJob::Notifier-worker-1 /usr/local/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:332 sleep> status=sleep priority=0
      /usr/local/rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/good_job-1.2.1/lib/good_job/notifier.rb:93:in `wait_for_notify'

Copy link
Owner

@bensheldon bensheldon left a comment

Choose a reason for hiding this comment

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

🎉 This is fantastic.

This is a more complex namer too here, but I like what you suggest here.

@pool_options[:name] = "GoodJob::Scheduler(queues=#{@performer.name} max_threads=#{@pool_options[:max_threads]} poll_interval=#{@timer_options[:execution_interval]})"

@bensheldon bensheldon merged commit 5a8460c into bensheldon:main Aug 25, 2020
@bensheldon bensheldon added the enhancement New feature or request label Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants