fix 日志首次读取部分数据

This commit is contained in:
jxxghp 2023-08-15 07:12:43 +08:00
parent e76606823f
commit 5da3406647

View File

@ -112,8 +112,8 @@ def get_logging(token: str):
def log_generator():
log_path = settings.LOG_PATH / 'moviepilot.log'
texts = tailer.tail(open(log_path, 'r'), 50)
while True:
yield 'data: %s\n\n' % '\n'.join(texts)
while True:
for text in tailer.follow(open(log_path, 'r')):
yield 'data: %s\n\n' % (text or '')
time.sleep(1)