lib/kurchatov/riemann/client.rb in kurchatov-0.0.5.pre5 vs lib/kurchatov/riemann/client.rb in kurchatov-0.0.5
- old
+ new
@@ -1,8 +1,8 @@
-require "timeout"
-require "socket"
-require "kurchatov/riemann/message"
+require 'timeout'
+require 'socket'
+require 'kurchatov/riemann/message'
module Kurchatov
module Riemann
class Client
@@ -17,18 +17,18 @@
@port = opts[:port] || RIEMANN_PORT
@mutex = Mutex.new
end
def <<(events)
- events = events.map {|e| Event.new(e) }
- message = Message.new(:events => events)
- with_connection do |socket|
- x = message.encode_with_length
- Timeout::timeout(SEND_TIMEOUT) {
- socket.write(x)
- socket.flush
- }
- end
+ events = events.map { |e| Event.new(e) }
+ message = Message.new(:events => events)
+ with_connection do |socket|
+ x = message.encode_with_length
+ Timeout::timeout(SEND_TIMEOUT) {
+ socket.write(x)
+ socket.flush
+ }
+ end
end
def with_connection
@mutex.synchronize do
yield(@socket || connect)