I'm giving async Sinatra a try and having a problem.
When using the following simple code:
require 'sinatra'
require 'sinatra/async'
Sinatra.register Sinatra::Async
aget '/delay/?' do
logger.info "Connected"
EM.add_timer(5) { body {"delayed for 5 seconds" } }
end
It runs fine when I concurrently request /delay/ with ab, taking 5 secs for all requests.
It does block however when I request /delay/ from within 2 Chrome tabs (or Firefox), and it executes sequentially, causing the 2nd request to take 10 secs.
The funny thing is that requesting it from multiple Safari tabs, again executes fine (in parallel).
Any idea, what might be causing this behavior?
Gem Versions:
gem 'sinatra', "~> 1.3.2"
gem "eventmachine", "1.0.0.beta.4.1"
gem 'thin', "~> 1.3.1"
gem "async_sinatra", "~> 1.0.0"