fix improper generator use
All checks were successful
Build and Push Docker Image / build (push) Successful in 12s
All checks were successful
Build and Push Docker Image / build (push) Successful in 12s
This commit is contained in:
parent
3e8072fb67
commit
c398cac067
@ -21,7 +21,7 @@ class LogFileReader:
|
||||
self._last_line_number = 0
|
||||
log.debug("%s created with path %s", self.__class__.__name__, str(file_path))
|
||||
|
||||
async def read(self):
|
||||
async def read(self) -> list[str]:
|
||||
if not self.file_path.exists():
|
||||
log.error("Cannot read non-existant file path: '%s'", self.file_path)
|
||||
raise FileNotFoundError(self.file_path)
|
||||
@ -30,17 +30,13 @@ class LogFileReader:
|
||||
if self._last_line_number == 0:
|
||||
await file.seek(0, 2)
|
||||
self._last_line_number = await file.tell()
|
||||
return
|
||||
return []
|
||||
|
||||
await file.seek(self._last_line_number)
|
||||
lines = await file.readlines()
|
||||
if not lines:
|
||||
log.debug("no new lines to read")
|
||||
return
|
||||
return []
|
||||
|
||||
self._last_line_number = await file.tell()
|
||||
|
||||
log.debug("lines to yield: %s", len(lines))
|
||||
for line in lines:
|
||||
yield line.strip()
|
||||
|
||||
return lines
|
||||
|
Reference in New Issue
Block a user