Skip to content

Commit de9d266

Browse files
committed
Fix race condition of flushing vs closing of log files
1 parent cf77a60 commit de9d266

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

plugins/log.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ def console_log(bot, event):
245245
bot.logger.info(text)
246246

247247

248-
@hook.on_stop
249248
@hook.command("flushlog", permissions=["botcontrol"])
250249
def flush_log():
251250
for name, stream in stream_cache.values():
@@ -254,9 +253,12 @@ def flush_log():
254253
stream.flush()
255254

256255

257-
@hook.on_stop(priority=Priority.LOWEST)
256+
@hook.on_stop
258257
def close_logs():
259258
for name, stream in stream_cache.values():
259+
stream.flush()
260260
stream.close()
261+
261262
for name, stream in raw_cache.values():
263+
stream.flush()
262264
stream.close()

0 commit comments

Comments
 (0)