Skip to content

Commit d1fd14b

Browse files
committed
Provide thread names whenever possible
1 parent 39b1e0e commit d1fd14b

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

lib/ldclient-rb/events.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def initialize(inbox, sdk_key, config, diagnostic_accumulator, event_sender)
253253
diagnostic_event_workers = nil
254254
end
255255

256-
Thread.new { main_loop(inbox, outbox, flush_workers, diagnostic_event_workers) }
256+
Thread.new { main_loop(inbox, outbox, flush_workers, diagnostic_event_workers) }.name = "LD/EventDispatcher#main_loop"
257257
end
258258

259259
private

lib/ldclient-rb/impl/integrations/file_data_source.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def initialize(resolved_paths, interval, reloader, logger)
216216
end
217217
end
218218
end
219+
@thread.name = "LD/Impl/Integrations/FileDataSourceImpl/FileDataSourcePoller"
219220
end
220221

221222
def stop

lib/ldclient-rb/impl/migrations/migrator.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ def write(key, context, default_stage, payload = nil)
188188
auth_handler = Thread.new { authoritative_result = authoritative.run }
189189
nonauth_handler = Thread.new { nonauthoritative_result = nonauthoritative.run }
190190

191+
auth_handler.name = "LD/Impl/Migrations/Migrator/auth_handler"
192+
nonauth_handler.name = "LD/Impl/Migrations/Migrator/nonauth_handler"
193+
191194
auth_handler.join()
192195
nonauth_handler.join()
193196
when LaunchDarkly::Migrations::MigratorBuilder::EXECUTION_RANDOM && @sampler.sample(2)

lib/ldclient-rb/impl/repeating_task.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def start
3030
sleep(delta)
3131
end
3232
end
33+
end.tap do |worker|
34+
worker.name = "LD/Impl/RepeatingTask"
3335
end
3436
end
3537

lib/ldclient-rb/non_blocking_thread_pool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module LaunchDarkly
1010
class NonBlockingThreadPool
1111
def initialize(capacity)
1212
@capacity = capacity
13-
@pool = Concurrent::FixedThreadPool.new(capacity)
13+
@pool = Concurrent::FixedThreadPool.new(capacity, name: "LD/NonBlockingThreadPool")
1414
@semaphore = Concurrent::Semaphore.new(capacity)
1515
end
1616

0 commit comments

Comments
 (0)