Module: Rainbows::NeverBlock

Extended by:
PoolSize
Defined in:
lib/rainbows/never_block.rb

Overview

NeverBlock library that combines the EventMachine library with Ruby Fibers. This includes use of Thread-based Fibers under Ruby 1.8. It currently does NOT support a streaming “rack.input” but is compatible with everything else EventMachine supports.

:pool_size vs worker_connections

In your Rainbows! config block, you may specify a Fiber pool size to limit your application concurrency (without using Rainbows::AppPool) independently of worker_connections.

Rainbows! do
  use :NeverBlock, :pool_size => 50
  worker_connections 100
end

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



32
33
34
35
# File 'lib/rainbows/never_block.rb', line 32

def self.extended(klass)
  klass.extend(Rainbows.const_get(Rainbows::O[:backend])) # EventMachine
  klass.extend(Rainbows::NeverBlock::Core)
end

.setupObject

same pool size NB core itself uses



25
26
27
28
29
30
# File 'lib/rainbows/never_block.rb', line 25

def self.setup # :nodoc:
  super
  Rainbows::O[:backend] ||= :EventMachine # no Cool.io support, yet
  Rainbows.const_get(Rainbows::O[:backend])
  require "never_block" # require EM first since we need a higher version
end