Skip to content

Commit ea5bde5

Browse files
committed
Allow specifying name for fixed thread pool
1 parent 6f5be7b commit ea5bde5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/ldclient-rb/events.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ def initialize(inbox, sdk_key, config, diagnostic_accumulator, event_sender)
243243
@events_in_last_batch = 0
244244

245245
outbox = EventBuffer.new(config.capacity, config.logger)
246-
flush_workers = NonBlockingThreadPool.new(MAX_FLUSH_WORKERS)
246+
flush_workers = NonBlockingThreadPool.new(MAX_FLUSH_WORKERS, 'EventDispatcher/FlushWorkers')
247247

248248
if !@diagnostic_accumulator.nil?
249-
diagnostic_event_workers = NonBlockingThreadPool.new(1)
249+
diagnostic_event_workers = NonBlockingThreadPool.new(1, 'EventDispatcher/DiagnosticEventWorkers')
250250
init_event = @diagnostic_accumulator.create_init_event(config)
251251
send_diagnostic_event(init_event, diagnostic_event_workers)
252252
else

lib/ldclient-rb/non_blocking_thread_pool.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ module LaunchDarkly
88
# than blocking. Also provides a way to wait for all jobs to finish without shutting down.
99
# @private
1010
class NonBlockingThreadPool
11-
def initialize(capacity)
11+
def initialize(capacity, name = 'LD/NonBlockingThreadPool')
1212
@capacity = capacity
13-
@pool = Concurrent::FixedThreadPool.new(capacity, name: "LD/NonBlockingThreadPool")
13+
@pool = Concurrent::FixedThreadPool.new(capacity, name: name)
1414
@semaphore = Concurrent::Semaphore.new(capacity)
1515
end
1616

0 commit comments

Comments
 (0)