Radek
Radek

Reputation: 11091

How to make sinatra process requests simultaneously?

I have simple sinatra script

require 'rubygems' 
require 'sinatra'  

get '/' do
  %x[sleep.bat] #dos batch file that waits for 10sec
end

which simulates my real sintra script that calls ant script. The ant run can finish in an hour or so. I want to use my sinatra application while the ant run is running. But sinatra waits till the ant run finishes. Then it processes whatever requests I made meanwhile.

I use

Upvotes: 0

Views: 457

Answers (1)

Larsenal
Larsenal

Reputation: 51146

Although a process that runs for an hour is really an entirely different situation, Rack applications are typically run with multiple app servers. This will allow you to make additional requests while your long-running call is busy.

You can run a Rack application under any of the typical ruby app servers. Passenger, Unicorn or Thin could all address your needs in this respect.

Upvotes: 2

Related Questions