Class: Airbrake::AsyncSender Private
- Inherits:
-
Object
- Object
- Airbrake::AsyncSender
- Defined in:
- lib/airbrake-ruby/async_sender.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Responsible for sending notices to Airbrake asynchronously.
Instance Method Summary collapse
- #close ⇒ void private
- #closed? ⇒ Boolean private
- #has_workers? ⇒ Boolean private
-
#initialize(method = :post, name = 'async-sender') ⇒ AsyncSender
constructor
private
A new instance of AsyncSender.
-
#send(data, promise, endpoint = @config.error_endpoint) ⇒ Airbrake::Promise
private
Asynchronously sends a notice to Airbrake.
Constructor Details
#initialize(method = :post, name = 'async-sender') ⇒ AsyncSender
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AsyncSender.
8 9 10 11 12 |
# File 'lib/airbrake-ruby/async_sender.rb', line 8 def initialize(method = :post, name = 'async-sender') @config = Airbrake::Config.instance @sync_sender = SyncSender.new(method) @name = name end |
Instance Method Details
#close ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
31 32 33 34 |
# File 'lib/airbrake-ruby/async_sender.rb', line 31 def close @sync_sender.close thread_pool.close end |
#closed? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/airbrake-ruby/async_sender.rb', line 37 def closed? thread_pool.closed? end |
#has_workers? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/airbrake-ruby/async_sender.rb', line 42 def has_workers? thread_pool.has_workers? end |
#send(data, promise, endpoint = @config.error_endpoint) ⇒ Airbrake::Promise
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Asynchronously sends a notice to Airbrake.
20 21 22 23 24 25 26 27 28 |
# File 'lib/airbrake-ruby/async_sender.rb', line 20 def send(data, promise, endpoint = @config.error_endpoint) unless thread_pool << [data, promise, endpoint] return promise.reject( "AsyncSender has reached its capacity of #{@config.queue_size}", ) end promise end |