Module: TestProf::EventProf::CustomEvents::SidekiqInline

Defined in:
lib/test_prof/event_prof/custom_events/sidekiq_inline.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: ClientPatch

Class Method Summary collapse

Class Method Details

.setup!Object



13
14
15
16
# File 'lib/test_prof/event_prof/custom_events/sidekiq_inline.rb', line 13

def setup!
  @depth = 0
  Sidekiq::Client.prepend ClientPatch
end

.trackObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/test_prof/event_prof/custom_events/sidekiq_inline.rb', line 18

def track
  @depth += 1
  res = nil
  begin
    res =
      if @depth == 1
        ActiveSupport::Notifications.instrument(
          'sidekiq.inline'
        ) { yield }
      else
        yield
      end
  ensure
    @depth -= 1
  end
  res
end