On Tuesday, October 23, 2012 9:09:25 AM UTC-7, Jeremy Evans wrote: > > On Monday, October 22, 2012 6:20:41 PM UTC-7, Rodrigo Rosenfeld Rosas > wrote: >> >> >> >> Em segunda-feira, 22 de outubro de 2012 19h34min26s UTC-2, Jeremy Evans >> escreveu: >>> >>> On Monday, October 22, 2012 11:47:29 AM UTC-7, Rodrigo Rosenfeld Rosas >>> wrote: >>>> >>>> I had to restart the PostgreSQL service in our database server and the >>>> Rails apps using Sequel stopped working. >>>> >>>> Is there a way to instruct Sequel to try to reconnect on such cases? >>>> One >>>> that works both for MRI and JRuby? >>>> >>>> >>> Sequel should be removing the connections from the pool, reraising the >>> exceptions, and creating new connections as needed in the future. So it's >>> expected that some DatabaseDisconnectErrors will be raised, but Sequel >>> should recover, assuming that it correctly recognizes the disconnections >>> (which it should on the postgres and jdbc/postgres adapters). If that >>> isn't what you experienced, please try to put together a reproducible test >>> case and I'll take a look. >>> >> >> But this is a problem for our setup as we have a cluster with a dozen >> servers and there will be as many reported errors as there are servers in >> the cluster and all of them end up in our SLA errors log which affects our >> contract :( >> >> Is there a way of just instructing Sequel to query something like "select >> 1" before attempting to use the connection? Hibernate has an option to do >> so and it works. Our application is a mix of a Grails and a Rails app. We >> only had to restart the Rails servers of the cluster as the Grails ones >> that used Hibernate with this option enabled didn't experience any issues. >> >> We'd like to be able to do something like with Sequel as well. >> >> Would that be possible? >> > > It's actually something I'm planning to implement as a extension very > soon. The recently committed refactoring of the database <-> connection > pool interface is the first step, I need to add code to check connections > for validity and then an extension that automatically checks connections > for validity when they are checked out from the pool. >
The code to check connections for validity has been pushed. I have the extension that automatically checks connections for validity on pool checkout written and apparently working based on the integration-level tests, but I still need to add documentation and extension-level tests. I expect that the extension will be pushed to the master branch sometime tomorrow. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/RGmbFTqEEYIJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
