Sha256: b630e098e1aae3e61230d75487379843ac722e0c63c25116e93b3c73a4a3ce58

Contents?: true

Size: 470 Bytes

Versions: 29

Compression:

Stored size: 470 Bytes

Contents

module Ring
class SQA

  class Receiver < Poller

    def run
      udp = udp_socket
      udp.bind address, port+1
      loop { receive udp }
    end

    private

    def initialize database
      @db = database
      run
    end

    def receive udp
      data, _ = udp.recvfrom MAX_READ
      timestamp, row_id = data.split(/\s+/)
      latency = (Time.now.utc.to_f - timestamp.to_f)*1_000_000
      @db.update row_id.to_i, 'ok', latency.to_i
    end
  end

end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
ring-sqa-0.4.3 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.4.2 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.4.1 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.3.1 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.3.0 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.2.2 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.2.1 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.2.0 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.12 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.11 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.10 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.9 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.8 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.7 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.6 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.5 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.4 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.3 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.2 lib/ring/sqa/poller/receiver.rb
ring-sqa-0.1.1 lib/ring/sqa/poller/receiver.rb