Class: Bugsnag::Delivery::ThreadQueue

Inherits:
Synchronous show all
Defined in:
lib/bugsnag/delivery/thread_queue.rb

Constant Summary collapse

MAX_OUTSTANDING_REQUESTS =
100
STOP =
Object.new

Constants inherited from Synchronous

Synchronous::HEADERS, Synchronous::TIMEOUT

Class Method Summary collapse

Class Method Details

.deliver(url, body) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bugsnag/delivery/thread_queue.rb', line 10

def deliver(url, body)
  if queue.length > MAX_OUTSTANDING_REQUESTS
    Bugsnag.warn("Dropping notification, #{queue.length} outstanding requests")
    return
  end

  # Add delivery to the worker thread
  queue.push proc { super(url, body) }

  # Make sure the worker thread is started
  ensure_worker_thread_started
end