[Twisted-web] mysql connect raise error although reconnect=true

Jean-Paul Calderone exarkun at divmod.com
Sun Jul 15 17:11:06 EDT 2007


On Sun, 15 Jul 2007 13:27:30 -0700, Andrey <alpha04 at netvigator.com> wrote:
>hello
>
>i have an xmlrpc daemon running and uses mysql for authorization. I noticed
>that the connection will timeout after a period of time.
>
>After investigated in the api, i found the cp_reconnect switch
>
>adbapi.ConnectionPool(DB_DRIVER,cp_reconnect=True, **DB_ARGS)
>
>however, my problem is, although the deamon will reconnect to mysql, it did
>raise an error and turn down the first login attempt before automatically
>reconnect the timeouted connection
>
>I wonder if this is normal and this switch is intented to raise error before
>reconnect?

Yes.  The exception must be propagated to application code, since there is
no general way to determine if the statement which caused the exception was
executed by the server or not.  The application needs to know the exception
occurred so that it can make a decision about whether to re-executed the
failed statement or not.

Jean-Paul



More information about the Twisted-web mailing list