Class: Rollbar::Delay::GirlFriday

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(payload) ⇒ Object



9
10
11
# File 'lib/rollbar/delay/girl_friday.rb', line 9

def call(payload)
  new.call(payload)
end

.queueObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rollbar/delay/girl_friday.rb', line 13

def queue
  @queue ||= self.queue_class.new(nil, :size => 5) do |payload|
    begin
      Rollbar.process_from_async_handler(payload)
    rescue
      # According to https://github.com/mperham/girl_friday/wiki#error-handling
      # we reraise the exception so it can be handled some way
      raise
    end
  end
end

.queue_classObject



5
6
7
# File 'lib/rollbar/delay/girl_friday.rb', line 5

def queue_class
  ::GirlFriday::WorkQueue
end

Instance Method Details

#call(payload) ⇒ Object



26
27
28
# File 'lib/rollbar/delay/girl_friday.rb', line 26

def call(payload)
  self.class.queue.push(payload)
end