Skip to content

Commit 6a4094b

Browse files
AlexanderZagaynovpitr-ch
authored andcommitted
simplify thread names
1 parent b1c6fd1 commit 6a4094b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/concurrent/executor/ruby_thread_pool_executor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def initialize(pool, id: nil)
300300
@queue = Queue.new
301301
@pool = pool
302302
@thread = create_worker @queue, pool, pool.idletime
303-
@thread.name = [pool.name, self.class.name, id].compact.join('-')
303+
@thread.name = [pool.name, 'worker', id].compact.join('-')
304304
end
305305

306306
def <<(message)

spec/concurrent/executor/ruby_thread_pool_executor_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ module Concurrent
7575
context 'without pool name' do
7676
let(:pool_name) { }
7777
it 'sets counted name' do
78-
expect(names.all? { |name| name =~ /^Concurrent.*Worker-\d+$/ }).to be true
78+
expect(names.all? { |name| name =~ /^worker-\d+$/ }).to be true
7979
end
8080
end
8181

8282
context 'with pool name' do
8383
let(:pool_name) { 'MyExecutor' }
8484
it 'sets counted name' do
85-
expect(names.all? { |name| name =~ /^MyExecutor-Concurrent.*Worker-\d+$/ }).to be true
85+
expect(names.all? { |name| name =~ /^MyExecutor-worker-\d+$/ }).to be true
8686
end
8787
end
8888
end

0 commit comments

Comments
 (0)