Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
778f3d03f635c2571133011b0ee22b9637915522 blob 996 bytes (raw)

 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
26
27
28
29
 
# -*- encoding: binary -*-

# Middleware that will run the app dispatch in a separate thread.
# This middleware is automatically loaded by Rainbows! when using
# EventMachine and if the app responds to the +deferred?+ method.
#
# Use EM.threadpool_size in your \Rainbows! config file to control
# the number of threads used by EventMachine.
#
# See http://brainspl.at/articles/2008/04/18/deferred-requests-with-merb-ebb-and-thin
# for more information.
class Rainbows::EventMachine::TryDefer
  def initialize(app) # :nodoc:
    # the entire app becomes multithreaded, even the root (non-deferred)
    # thread since any thread can share processes with others
    Rainbows::Const::RACK_DEFAULTS['rack.multithread'] = true
    @app = app
  end

  def call(env) # :nodoc:
    if @app.deferred?(env)
      EM.defer(proc { catch(:async) { @app.call(env) } }, env['async.callback'])
      # all of the async/deferred stuff breaks Rack::Lint :<
      nil
    else
      @app.call(env)
    end
  end
end
debug log:

solving 778f3d0 ...
found 778f3d0 in http://bogomips.org/rainbows.git

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror http://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git