Method: Sentry.get_current_hub
- Defined in:
- lib/sentry-ruby.rb
.get_current_hub ⇒ Hub
Returns the current active hub. If the current thread doesn’t have an active hub, it will clone the main thread’s active hub, stores it in the current thread, and then returns it.
338 339 340 341 342 343 344 345 |
# File 'lib/sentry-ruby.rb', line 338 def get_current_hub # we need to assign a hub to the current thread if it doesn't have one yet # # ideally, we should do this proactively whenever a new thread is created # but it's impossible for the SDK to keep track every new thread # so we need to use this rather passive way to make sure the app doesn't crash Thread.current.thread_variable_get(THREAD_LOCAL) || clone_hub_to_current_thread end |