def _getLastEventIdFromDatabase(self):
    conn_attempts = 0
    lastEventId = None
    while (lastEventId is None):
        order = [{'column': 'id', 'direction': 'desc'}]
        try:
            result = self._sg.find_one('EventLogEntry', filters=[], fields=['id'], order=order)
        except (sg.ProtocolError, sg.ResponseError, socket.error) as err:
            conn_attempts = self._checkConnectionAttempts(conn_attempts, str(err))
        except Exception as err:
            msg = ('Unknown error: %s' % str(err))
            conn_attempts = self._checkConnectionAttempts(conn_attempts, msg)
        else:
            lastEventId = result['id']
            self.log.info('Last event id (%d) from the SG database.', lastEventId)
    return lastEventId
def _getLastEventIdFromDatabase(self):
    conn_attempts = 0
    lastEventId = None
    while (lastEventId is None):
        order = [{'column': 'id', 'direction': 'desc'}]
        try:
            result = self._sg.find_one('EventLogEntry', filters=[], fields=['id'], order=order)
        except (sg.ProtocolError, sg.ResponseError, socket.error) as err:
            conn_attempts = self._checkConnectionAttempts(conn_attempts, str(err))
        except Exception as err:
            msg = ('Unknown error: %s' % str(err))
            conn_attempts = self._checkConnectionAttempts(conn_attempts, msg)
        else:
            lastEventId = result['id']
            self.log.info('Last event id (%d) from the SG database.', lastEventId)
    return lastEventId