Skip to content

Commit

Permalink
Fix error in log stream when server is idle (#565)
Browse files Browse the repository at this point in the history
Fixes
TypeError: cannot unpack non-iterable NoneType object when server has be idle in the log stream.
The scenario occurs when last_seen is None and the tail returns None
  • Loading branch information
ExcuseMi committed May 28, 2024
1 parent 21abeb6 commit 3f59440
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rcon/game_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ def logs_since(
"""Return a list of logs more recent than the last_seen ID"""
try:
if last_seen is None:
logs: list[tuple[StreamID, StructuredLogLineWithMetaData]] = [
self.log_stream.tail()
]
logs: list[tuple[StreamID, StructuredLogLineWithMetaData]] = []
tail_log: tuple[StreamID, StructuredLogLineWithMetaData] = self.log_stream.tail()
if tail_log:
logs.append(tail_log)
else:
logs: list[tuple[StreamID, StructuredLogLineWithMetaData]] = (
self.log_stream.read(last_id=last_seen, block_ms=block_ms)
Expand Down

0 comments on commit 3f59440

Please sign in to comment.