Don't raise InvalidLog
because there's nothing you can do about it anyways, so there's no need to stop.
This commit is contained in:
parent
6a84b35a52
commit
caff246f9a
|
@ -4,8 +4,6 @@ import datetime
|
||||||
import logging
|
import logging
|
||||||
from collections import MutableMapping
|
from collections import MutableMapping
|
||||||
|
|
||||||
from tsstats.exceptions import InvalidLog
|
|
||||||
|
|
||||||
logger = logging.getLogger('tsstats')
|
logger = logging.getLogger('tsstats')
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +100,7 @@ class Client(object):
|
||||||
logger.debug('[%s] DISCONNECT %s', timestamp, self)
|
logger.debug('[%s] DISCONNECT %s', timestamp, self)
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
logger.debug('^ disconnect before connect')
|
logger.debug('^ disconnect before connect')
|
||||||
raise InvalidLog('disconnect before connect!')
|
return
|
||||||
self.connected -= 1
|
self.connected -= 1
|
||||||
session_time = timestamp - self._last_connect
|
session_time = timestamp - self._last_connect
|
||||||
logger.debug('Session lasted %s', session_time)
|
logger.debug('Session lasted %s', session_time)
|
||||||
|
|
|
@ -5,11 +5,3 @@ class InvalidConfiguration(Exception):
|
||||||
'''
|
'''
|
||||||
The configuration is invalid (either config-file or cli-args)
|
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
|
|
||||||
|
|
|
@ -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
|
|
|
@ -1,7 +1,6 @@
|
||||||
import pendulum
|
import pendulum
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tsstats.exceptions import InvalidLog
|
|
||||||
from tsstats.log import TimedLog, _bundle_logs, _parse_details, parse_logs
|
from tsstats.log import TimedLog, _bundle_logs, _parse_details, parse_logs
|
||||||
from tsstats.template import render_servers
|
from tsstats.template import render_servers
|
||||||
|
|
||||||
|
@ -74,11 +73,6 @@ def test_log_bundle(logs, bundled):
|
||||||
assert _bundle_logs(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():
|
def test_log_client_online():
|
||||||
current_time = pendulum.now()
|
current_time = pendulum.now()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue