From 0e1f676acc4bc5f5cb5040107eeefe652530ff95 Mon Sep 17 00:00:00 2001 From: Dpeta Date: Fri, 10 Jun 2022 21:53:56 +0200 Subject: [PATCH] Fixed only 'text' logs getting fsynced on write (html & bbcode were only being writen on closing the memo window) --- profile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/profile.py b/profile.py index 4bb6778..b16a1b3 100644 --- a/profile.py +++ b/profile.py @@ -79,12 +79,11 @@ class PesterLog(object): for (format, t) in modes.items(): f = self.convos[handle][format] f.write(t+"\r\n") - - # flush + fsync force a write, might not be required though. - for (format, t) in modes.items(): + # flush + fsync force a write, + # makes sure logs are saved in the case of a crash. f.flush() os.fsync(f.fileno()) - + # This way the file descriptors are closed and reopened for every message, # which is sub-optimal and definitely a performance drain but, # otherwise we still run into the ulimit on platforms like MacOS fairly easily.