Skip to content

Commit

Permalink
Fix socket checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kesmit13 committed Jan 31, 2024
1 parent e0f7561 commit 87fef37
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions singlestoredb/mysql/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,8 @@ def _sync_connection(self):
raise err.InterfaceError(0, 'Connection URL has not been established')

# If it's just a password change, we don't need to reconnect
if (self.host, self.port, self.user, self.db) == \
if self._sock is not None and \
(self.host, self.port, self.user, self.db) == \
(out['host'], out['port'], out['user'], out.get('database')):
return

Expand Down Expand Up @@ -1167,7 +1168,7 @@ def _execute_command(self, command, sql):
"""
self._sync_connection()

if not self._sock:
if self._sock is None:
raise err.InterfaceError(0, 'The connection has been closed')

# If the last query was unbuffered, make sure it finishes before
Expand Down

0 comments on commit 87fef37

Please sign in to comment.