rainbows.git  about / heads / tags
Unicorn for sleepy apps and slow clients
blob 01282f5dc876583a441b86ab86d23b5f7176febe 397 bytes (raw)
$ git show v0.90.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
22
23
24
25
 
# -*- encoding: binary -*-
require 'rainbows/rev'

module Rainbows

  module Rev
    class 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
  end
end

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