Class: Rack::Logstash::Transport
- Inherits:
-
Object
- Object
- Rack::Logstash::Transport
- Defined in:
- lib/rack/logstash/transport.rb
Instance Method Summary collapse
- #drain ⇒ Object
-
#initialize(url) ⇒ Transport
constructor
A new instance of Transport.
- #send(s) ⇒ Object
Constructor Details
#initialize(url) ⇒ Transport
Returns a new instance of Transport.
8 9 10 11 12 13 |
# File 'lib/rack/logstash/transport.rb', line 8 def initialize(url) @url = url @backlog = [] @blmutex = Mutex.new @sender = sender_thread end |
Instance Method Details
#drain ⇒ Object
20 21 22 23 24 |
# File 'lib/rack/logstash/transport.rb', line 20 def drain until @blmutex.synchronize { @backlog.empty? } sleep 0.001 end end |
#send(s) ⇒ Object
15 16 17 18 |
# File 'lib/rack/logstash/transport.rb', line 15 def send(s) @blmutex.synchronize { @backlog << s } @sender.run end |