On Sunday, May 5, 2013 9:37:21 PM UTC-7, [email protected] wrote:

> Hey Everyone,
>
> I am using Sequel on my Rails app, and have it initialized in the 
> following way at the bottom of my "config/application.rb" file:
>
>   DB = Sequel.connect(ENV['DATABASE_URL'] || 
> Alphabot::Application.config.database_configuration[Rails.env])
>
> Things work fine on cron-jobs or console and raketasks, however on 
> Passener, I get the following error after restarting the server, or when 
> the server does not get a request for a while:
>
>   Sequel::DatabaseDisconnectError: PG::Error: no connection to the server
>
> Thing is, that after I refresh the page a couple of times, things work 
> a-ok.  Just seems that it takes passenger a bit to work with Sequel after 
> restarting.  Is there a better way I should be setting Sequel up?
>

You are probably using the smart loading feature where it loads the app 
before forking, and children are sharing the connections.  If so, you need 
to disconnect the database connections before fork.  With passenger, 
calling Database#disconnect after loading your models will probably fix it.

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to