Class: ErrorLens::Processor
- Inherits:
-
Object
- Object
- ErrorLens::Processor
- Defined in:
- lib/error_lens/processor.rb
Constant Summary collapse
- QUEUE_LIMIT =
500
Class Method Summary collapse
Instance Method Summary collapse
- #enqueue(event) ⇒ Object
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
13 14 15 16 17 |
# File 'lib/error_lens/processor.rb', line 13 def initialize @queue = SizedQueue.new(QUEUE_LIMIT) @thread = nil @mutex = Mutex.new end |
Class Method Details
.enqueue(event) ⇒ Object
5 6 7 |
# File 'lib/error_lens/processor.rb', line 5 def self.enqueue(event) instance.enqueue(event) end |
.instance ⇒ Object
9 10 11 |
# File 'lib/error_lens/processor.rb', line 9 def self.instance @instance ||= new end |
Instance Method Details
#enqueue(event) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/error_lens/processor.rb', line 19 def enqueue(event) ensure_running @queue.push(event, true) rescue ThreadError # Queue is full, drop the event rescue end |