From 35615caa70bffe66453cee910e13885a83cfcf63 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Thu, 28 Dec 2023 20:10:47 +0100 Subject: [PATCH] Made it less annoying. xD --- background_job.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/background_job.py b/background_job.py index 7837bad..f39b302 100644 --- a/background_job.py +++ b/background_job.py @@ -58,6 +58,8 @@ def ram_full(): def loop(): + warning_cooldown = 0 + while True: ram_usage = ram_perc() swap_usage = swap_perc() @@ -65,8 +67,14 @@ def loop(): if ram_usage >= 98 and swap_usage >= 98: ram_full() - elif ram_usage >= 90: + elif ram_usage >= 90 = warning_cooldown == 0: ram_almost_full() + warning_cooldown = 30 + + else: + warning_cooldown -= 1 + + sleep(1) if __name__ == "__main__":