Module: Rhoconnect::Synchrony

Defined in:
lib/rhoconnect/async.rb

Instance Method Summary collapse

Instance Method Details

#handle_exceptionObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rhoconnect/async.rb', line 18

def handle_exception
  Proc.new do |env, e|
    if settings.show_exceptions?
      request = Sinatra::Request.new(env)
      printer = Sinatra::ShowExceptions.new(proc{ raise e })
      s, h, b = printer.call(env)
      [s, h, b]
    else
      [500, {}, ""]
    end
  end
end

#setup_sessions(builder) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/rhoconnect/async.rb', line 7

def setup_sessions(builder)
  options = {}
  if settings.respond_to?(:fiberpool_size)
    options[:size] = settings.fiberpool_size
  end
  options[:rescue_exception] = handle_exception
  builder.use Rack::FiberPool, options unless test?
  builder.use Rhoconnect::Middleware::Async, options
  super
end