Class: Rollbar::Delay::Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/rollbar/delay/thread.rb

Constant Summary collapse

EXIT_SIGNAL =
:exit
EXIT_TIMEOUT =
3
Error =
Class.new(StandardError)
TimeoutError =
Class.new(Error)

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.reaperObject (readonly)

Returns the value of attribute reaper.



14
15
16
# File 'lib/rollbar/delay/thread.rb', line 14

def reaper
  @reaper
end

Class Method Details

.call(payload) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rollbar/delay/thread.rb', line 16

def call(payload)
  spawn_threads_reaper

  thread = new.call(payload)
  threads << thread
  thread
end

Instance Method Details

#call(payload) ⇒ Object

class << self



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/rollbar/delay/thread.rb', line 64

def call(payload)
  ::Thread.new do
    begin
      Rollbar.process_from_async_handler(payload)
    rescue
      # Here we swallow the exception:
      # 1. The original report wasn't sent.
      # 2. An internal error was sent and logged
      #
      # If users want to handle this in some way they
      # can provide a more custom Thread based implementation
    end
  end
end