Skip to content

Commit 7bf5ac9

Browse files
author
David Erb
committed
changes logging slightly
1 parent c40e828 commit 7bf5ac9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/dls_normsql/aiomysql.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,15 @@ async def disconnect(self):
215215

216216
if self.__connection is not None:
217217
# Commit final transaction if not currently autocommitting.
218-
if not self.__connection.get_autocommit():
219-
logger.debug(f"[DISSHU] {callsign(self)} committing final transaction")
218+
try:
220219
await self.__connection.commit()
220+
logger.debug(
221+
f"[DISSHU] {callsign(self)} successfully committed final transaction"
222+
)
223+
except Exception as exception:
224+
logger.warning(
225+
callsign(self, explain(exception, "committing final transaction"))
226+
)
221227
logger.debug(f"[DISSHU] {callsign(self)} closing connection to server")
222228
self.__connection.close()
223229
self.__connection = None

0 commit comments

Comments
 (0)