Sha256: 9f4c62b4403378134104ffcc15e7e8206b39b95292da981a9b0ef8529c82903e

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

require "rubygems"
require "eventmachine"
require 'em-hiredis'

module Runner

  def self.redis
    @redis ||= EM::Hiredis.connect("redis://localhost:6379")
  end

  def self.next
    redis.blpop('fnordmetric-queue', 0).callback do |list, data|
      puts data
      EM.next_tick(&method(:next))
    end
  end

end


module Ticker

  def self.tick
    EM.defer(proc { print '.'; sleep 1; }, proc{ EM.next_tick(&method(:tick)) })
    #EM.next_tick(&method(:next))    
  end

end

EM.run do
  Ticker.tick
  Runner.next
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fnordmetric-0.5.0 em_runner.rb