From 4964bc23660c256bacbfa80a8e9c3ab31a6a389c Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Fri, 3 Nov 2023 07:57:32 +0100 Subject: [PATCH] Improve status checks before closing underlying connection --- exasol/driver/websocket/_connection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exasol/driver/websocket/_connection.py b/exasol/driver/websocket/_connection.py index 20c1944b..2d51a71a 100644 --- a/exasol/driver/websocket/_connection.py +++ b/exasol/driver/websocket/_connection.py @@ -119,12 +119,13 @@ def connection(self): def close(self): """See also :py:meth: `Connection.close`""" - if not self._connection: + if self._connection is None or self._connection.is_closed: return try: self._connection.close() except Exception as ex: raise Error() from ex + self._connection = None @_requires_connection def commit(self):