You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connection's connection_id is not updated upon reconnect.
Reproducibility
while loop printing connection id with kill from mysql session
Expected Behavior
connection id should update & match new ID
Additional Research and Context
copying this snippet from constructor into the reconnect logic appears to do the trick; not sure if this is the best place for it however (should perhaps be done in connect_host_hook or Connection.connect, but not sure of other implications) - can PR if is the desired approach:
$ git diff
diff --git a/datajoint/connection.py b/datajoint/connection.py
index 9db3dcb..f2c2f07 100644
--- a/datajoint/connection.py
+++ b/datajoint/connection.py
@@ -305,6 +305,10 @@ class Connection:
raise
warnings.warn("MySQL server has gone away. Reconnecting to the server.")
connect_host_hook(self)
+ if self.is_connected:
+ logger.info("Connected {user}@{host}:{port}".format(**self.conn_info))
+ self.connection_id = self.query('SELECT connection_id()').fetchone()[0]
+
if self._in_transaction:
self.cancel_transaction()
raise errors.LostConnectionError("Connection was lost during a transaction.")
The text was updated successfully, but these errors were encountered:
Bug Report
Description
Connection's connection_id is not updated upon reconnect.
Reproducibility
while loop printing connection id with kill from mysql session
Expected Behavior
connection id should update & match new ID
Additional Research and Context
copying this snippet from constructor into the reconnect logic appears to do the trick; not sure if this is the best place for it however (should perhaps be done in connect_host_hook or Connection.connect, but not sure of other implications) - can PR if is the desired approach:
The text was updated successfully, but these errors were encountered: