sdizazzo / pyaltitude

Python wrapper for interacting with and making mods for the Altitude game's built in server
http://altitudegame.com/
MIT License
1 stars 0 forks source link

Log rollover doesn't happen on newlines #15

Closed sdizazzo closed 4 years ago

sdizazzo commented 4 years ago

The below comes soon after a log rolling over message. Pretty clear that the log reolled over and left only half the line behind. There is also another error with the other half of the line.

2020-02-24 18:44:57,830 - pyaltitude.Worker - ERROR - Worker could not parse log line: {"positionByPlayer":{"0":"1312,1006,-54","1":"-1,-1,-1","2":"1304,977
2020-02-24 18:44:57,831 - pyaltitude - ERROR - Worker raised exception: ValueError('Unmatched \'\'"\' when when decoding \'string\'')
Traceback (most recent call last):
  File "./pyaltitude.py", line 157, in worker_done_cb
    fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "./pyaltitude.py", line 78, in execute
    event = ujson.loads(self.line)
ValueError: Unmatched ''"' when when decoding 'string'
sdizazzo commented 4 years ago

https://github.com/sdizazzo/pyaltitude/commit/7b8fcc08cfafe1f2a7237b19816dea15934ae20b Dis not resolve the issue. Roll back the tail() changes and do it either by pyinotify or read the file by chunks instead of lines.