lib/pigato/worker.rb in pigato-0.2.9 vs lib/pigato/worker.rb in pigato-0.2.10

- old
+ new

@@ -3,11 +3,10 @@ HEARTBEAT_LIVENESS = 3 # 3-5 is reasonable def initialize broker, service @broker = broker @service = service - @context = ZMQ::Context.new(1) @socket = nil # Socket to broker @heartbeat_at = 0 # When to send HEARTBEAT (relative to time.time(), so in seconds) @liveness = 0 # How many attempts left @timeout = 2500 @heartbeat = 2500 # Heartbeat delay, msecs @@ -79,9 +78,10 @@ def reconnect_to_broker if @socket @socket.close end + @context = ZMQ::Context.new @socket = @context.socket ZMQ::DEALER @context.linger = 0 @socket.identity = SecureRandom.uuid @socket.connect @broker @socket.rcvtimeo = @timeout;