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__":