module Rainbows

See yhbt.net/rainbows/ for documentation

Public Class Methods

sleep(seconds) click to toggle source

Sleeps the current application dispatch. This will pick the optimal method to sleep depending on the concurrency model chosen (which may still suck and block the entire process). Using this with the basic :Coolio or :EventMachine models is not recommended. This should be used within your Rack application.

# File lib/rainbows.rb, line 36
def self.sleep(seconds)
  case Rainbows.server.use
  when :FiberPool, :FiberSpawn
    Rainbows::Fiber.sleep(seconds)
  when :RevFiberSpawn, :CoolioFiberSpawn
    Rainbows::Fiber::Coolio::Sleeper.new(seconds)
  when :Revactor
    Actor.sleep(seconds)
  else
    Kernel.sleep(seconds)
  end
end