Module: Fnf::RequestWorker

Defined in:
lib/fnf/worker.rb

Instance Method Summary collapse

Instance Method Details

#initialize(pipe) ⇒ Object



4
5
6
# File 'lib/fnf/worker.rb', line 4

def initialize(pipe)
  @pipe = pipe
end

#notify_readableObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/fnf/worker.rb', line 8

def notify_readable
  data = @pipe.readline.chomp
  fetch = proc {
    payload = MessagePack.unpack(data)
    Connection.send(payload[0], payload[1], payload[2])
  }
  noop = proc { }
  EM.defer fetch, noop

end