On Mar 16, 2010, at 10:25 PM, Julian Scheid wrote: > On Wed, Mar 17, 2010 at 3:10 PM, Michael Bayer <[email protected]> > wrote: >> Well the pool only holds at one time the number of connections that you >> configure - it has an "overflow" of connections if more are requested but >> those aren't held around. > > Yep, but "overflow" connections are discarded immediately and other > connections are held indefinitely - I'm looking for something in > between. > >> But as you mentioned, it seems you're really looking for a thread here that >> will reduce the size of the pool asynchronously, so simple enough to just >> run a background thread which iterates through the pool calling invalidate() >> on connections older than 30 seconds. Its likely a 10 liner. I'd >> appreciate if you can put it up on the UsageRecipes wiki page if you have >> success. > > Sure, I'm happy to do that. > > I realize there's not a lot of code involved but in my experience > everything that involves concurrency can be a bit tricky to get right, > what with race conditions and all, which is why I was hoping for an > existing, proven solution. Oh well, I'll see what I can come up with.
if your cleanup handler only expires connections that are older than the "pool_expire" time, that should help. > > Thanks again, > > Julian > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > 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/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. 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/sqlalchemy?hl=en.
