rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 21b583a60882ff3fc86198a1cb8060860c8998b4 325 bytes (raw)
$ git show v0.97.0:lib/rainbows/rev/master.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
# -*- encoding: binary -*-
# :enddoc:
require 'rainbows/rev'

class Rainbows::Rev::Master < Rev::AsyncWatcher

  def initialize(queue)
    super()
    @queue = queue
  end

  def <<(output)
    @queue << output
    signal
  end

  def on_signal
    client, response = @queue.pop
    client.response_write(response)
  end
end

git clone https://yhbt.net/rainbows.git