Comment 13 for bug 94986

Revision history for this message
Jamu Kakar (jkakar) wrote :

These comments are for ~niemeyer/storm/mysql-reconnection

[1]

+ def is_disconnection_error(self, exc):
+ # http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
+ return (isinstance(exc, OperationalError) and
+ exc.args[0] in (2006, 2013)) # (SERVER_GONE_ERROR, SERVER_LOST)

These error codes, 2006 and 2013, are defined in MySQLdb.constants.CR
with the SERVER_GONE_ERROR and SERVER_LOST constants. They should be
used instead of hard-coded integers.

[2]

+ msg = str(exc)
         return (msg.startswith('server closed the connection unexpectedly') or
                 msg.startswith('could not connect to server') or
                 msg.startswith('no connection to the server') or

This wasn't added in this branch, but the single-quotes here should be
double-quotes.

+1 considering #1. This is a very nice and straight-forward branch.