On Fri, Sep 19, 2014 at 10:40:28AM -0700, Iain Duncan wrote: > Hi folks, I'm putting together something for a client that will get used > very occasionally, and has a some worker processes that use SQLA. I'm > wondering what the right approach is for the dreaded "MySQL has gone away". > Should I just use some absurdly high number for pool_recycle ( ie months) > or is there a smarter way to do it.
Sqlalchemy drops connections from the pool which have been idle longer than pool_recycle. If you're having "gone away"s, you don't need a longer pool_recycle, you need a shorter one. It needs to be shorter than mysql's connect-timeout. > It's a process to send out a bunch of > sms messages via twilio, so it totally doesn't matter if takes a bit to > wake up. > > Is disabling pooling with NullPool the right way to go? That would work, I guess (at the expense of pooling.) Other options: - Optimistic: Use (a shorter) pool_recycle http://docs.sqlalchemy.org/en/rel_0_9/dialects/mysql.html#connection-timeouts - Pessimistic: Ping the connection on every checkout http://docs.sqlalchemy.org/en/rel_0_9/core/pooling.html#disconnect-handling-pessimistic -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.