I have a test application written in ruby ββusing Sinatra + Sequel.
config.ru:
require './main' run Sinatra::Application
Code example:
require 'sinatra' require 'haml' require 'sequel' DB=Sequel.connect('oracle://test: test@test ') class Tarification < Sequel::Model(DB[:test_table]) end get '/' do haml :index end
Everything was fine until I started using Phusion Passenger in my test environment. Now I have an exception in nginx error.log:
Sequel :: DatabaseError - RuntimeError: The connection cannot be reused in a forked process.
Is it correct to place the procedure for connecting to DB in the config.ru configuration file or is it better to do it differently? If the first option is different than how to make a call to connect to the application code correctly?
PS: I know that I can make the passenger_spawn_method conservative and continue to open the connection in the application code, but this is not the way I'm looking for because of its speed and resource usage problems.
source share