From ac019d8aa9dc090025b06c62c10e27c042b2dd10 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 3 Oct 2022 11:12:40 -0300 Subject: Fix edge case where an orphan/zombified logmaster would use 100% CPU --- logmaster.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'logmaster.py') diff --git a/logmaster.py b/logmaster.py index a8afa075e..ebd92ccc4 100755 --- a/logmaster.py +++ b/logmaster.py @@ -206,8 +206,6 @@ while running: sqli.remove(com) db.commit() w.close() - ## No need to flush ALL the time - time.sleep(SQL_FLUSH) except KeyboardInterrupt: running=False stdout("Shutdown in progress!") @@ -215,6 +213,10 @@ while running: except: traceback.print_exc() + ## No need to flush ALL the time + if running: + time.sleep(SQL_FLUSH) + db.close() stdout("Logmaster finished.") -- cgit v1.2.3-60-g2f50