Class: Bugsnag::Delivery::ThreadQueue
- Inherits:
-
Synchronous
- Object
- Synchronous
- Bugsnag::Delivery::ThreadQueue
- Defined in:
- lib/bugsnag/delivery/thread_queue.rb
Constant Summary collapse
- MAX_OUTSTANDING_REQUESTS =
100
- STOP =
Object.new
- MUTEX =
Mutex.new
Class Method Summary collapse
-
.serialize_and_deliver(url, get_payload, configuration, options = {}) ⇒ void
Queues a given payload to be delivered asynchronously.
Class Method Details
.serialize_and_deliver(url, get_payload, configuration, options = {}) ⇒ void
This method returns an undefined value.
Queues a given payload to be delivered asynchronously
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bugsnag/delivery/thread_queue.rb', line 17 def serialize_and_deliver(url, get_payload, configuration, ={}) @configuration = configuration start_once! if @queue.length > MAX_OUTSTANDING_REQUESTS @configuration.warn("Dropping notification, #{@queue.length} outstanding requests") return end # Add delivery to the worker thread @queue.push(proc do begin payload = get_payload.call rescue StandardError => e configuration.error("Unable to send information to Bugsnag (#{url}), #{e.inspect}") configuration.error(e.backtrace) end Synchronous.deliver(url, payload, configuration, ) unless payload.nil? end) end |