Is this question related to active record or sequel? If it's the former, you're on the wrong mailing list... On Mar 27, 2014 6:33 AM, "Jeff" <[email protected]> wrote:
> I have a Rails app that makes connections to other DBs. There may be > multiple users connecting to multiple DBs. > > The app makes a database connection as part of an action. However, I > noticed a problem: there's too many DB connections remaining open, which is > causing the DB to not have enough connections remaining for new > connections. (psql: FATAL: remaining connection slots are reserved for > non-replication superuser connections) > > So I should manually call disconnect to disconnect connections. That's > fair enough. > > However, is there a better way, maybe some way to persist a DB connection > through the app unless it wasn't used in the last 5 minutes? Rather than > re-opening DB connections with each action and each user, it'd be more > efficient to keep the DB connection open and share it amongst users and > requests, but automatically disconnect if it hasn't been called in the last > few minutes. > > In Python I think you can use pickling for this purpose. Maybe. > > Can anyone suggest a good way to do this with Ruby on Rails? Or share > sample code? > > Thanks. > > -- > 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/d/optout. > -- 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/d/optout.
