def close_instance(self, connection: PooledMySQLConnection, cursor: MySQLCursor) -> None: if connection is not None and connection.is_connected(): if cursor is not None: cursor.close() connection.close() self._logger.info( f"MySQL connection is closed. - PID: {os.getpid()}") else: self._logger.info( "Connection has been disconnect or be killed before.")
def _is_connected(self, conn: PooledMySQLConnection) -> bool: return conn.is_connected()