Hello,

I have a Rails 3 app using Sequel v3.48.0. Sequel is connecting to two 
databases. My initializer looks something like this:

unless defined? DB
  DB = Sequel.connect(ENV["DATABASE_URL"])
end

unless defined? GP
  GP = Sequel.connect(ENV["GP_DATABASE_URL"])
end

The DB database is connecting to a PostgreSQL database. The GP database is 
connecting to a MicrosoftSQL database via TinyTds.

Things work well, but after an hour or so of inactivity I get this error 
when I try to visit a page: 

Sequel::DatabaseDisconnectError: TinyTds::Error: DBPROCESS is dead or not 
enabled

Once I refresh the page a couple of times this error goes away. I'm using 
Unicorn and I have this in my before_hook:

before_fork do |server, worker|
  DB.disconnect if defined? DB
  GP.disconnect if defined? GP
  sleep 1
end

It might be worth noting that the MicrosoftSQL database is on a different 
network then the Rails app, so connection can be slow.

Any ideas what could be causing this? It is driving me nuts. Thanks!

Yours,
Jason Coffin

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to