Fixed only 'text' logs getting fsynced on write

(html & bbcode were only being writen on closing the memo window)
This commit is contained in:
Dpeta 2022-06-10 21:53:56 +02:00
parent e3bdbf77f4
commit 0e1f676acc

View file

@ -79,12 +79,11 @@ class PesterLog(object):
for (format, t) in modes.items(): for (format, t) in modes.items():
f = self.convos[handle][format] f = self.convos[handle][format]
f.write(t+"\r\n") f.write(t+"\r\n")
# flush + fsync force a write,
# flush + fsync force a write, might not be required though. # makes sure logs are saved in the case of a crash.
for (format, t) in modes.items():
f.flush() f.flush()
os.fsync(f.fileno()) os.fsync(f.fileno())
# This way the file descriptors are closed and reopened for every message, # This way the file descriptors are closed and reopened for every message,
# which is sub-optimal and definitely a performance drain but, # which is sub-optimal and definitely a performance drain but,
# otherwise we still run into the ulimit on platforms like MacOS fairly easily. # otherwise we still run into the ulimit on platforms like MacOS fairly easily.