diff --git a/tsstats/client.py b/tsstats/client.py index d56259e..a933d53 100644 --- a/tsstats/client.py +++ b/tsstats/client.py @@ -4,8 +4,6 @@ import datetime import logging from collections import MutableMapping -from tsstats.exceptions import InvalidLog - logger = logging.getLogger('tsstats') @@ -102,7 +100,7 @@ class Client(object): logger.debug('[%s] DISCONNECT %s', timestamp, self) if not self.connected: logger.debug('^ disconnect before connect') - raise InvalidLog('disconnect before connect!') + return self.connected -= 1 session_time = timestamp - self._last_connect logger.debug('Session lasted %s', session_time) diff --git a/tsstats/exceptions.py b/tsstats/exceptions.py index eb3ba70..d0266ab 100644 --- a/tsstats/exceptions.py +++ b/tsstats/exceptions.py @@ -5,11 +5,3 @@ class InvalidConfiguration(Exception): ''' The configuration is invalid (either config-file or cli-args) ''' - - -class InvalidLog(Exception): - ''' - Something impossible appeared at the logs, - for example a disconnect before a connect - ''' - pass diff --git a/tsstats/tests/res/test.log.broken b/tsstats/tests/res/test.log.broken deleted file mode 100644 index ad43997..0000000 --- a/tsstats/tests/res/test.log.broken +++ /dev/null @@ -1,3 +0,0 @@ -2016-06-18 14:22:12.161100|INFO |VirtualServer| 1| listening on 0.0.0.0:9987 -2015-05-18 16:00:14.951191|INFO |VirtualServerBase| 3| client disconnected 'Client1'(id:1) reason 'reasonmsg=ByeBye!' -2015-05-18 15:55:23.456679|INFO |VirtualServerBase| 3| client connected 'Client1'(id:1) from 1.2.3.4:1234 diff --git a/tsstats/tests/test_log.py b/tsstats/tests/test_log.py index 785aee8..f49ad55 100644 --- a/tsstats/tests/test_log.py +++ b/tsstats/tests/test_log.py @@ -1,7 +1,6 @@ import pendulum import pytest -from tsstats.exceptions import InvalidLog from tsstats.log import TimedLog, _bundle_logs, _parse_details, parse_logs from tsstats.template import render_servers @@ -74,11 +73,6 @@ def test_log_bundle(logs, bundled): assert _bundle_logs(logs) == bundled -def test_log_invalid(): - with pytest.raises(InvalidLog): - _parse_details('tsstats/tests/res/test.log.broken') - - def test_log_client_online(): current_time = pendulum.now()