From cf671bb42b95dee68ed7fd85a262b71a55797726 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Sun, 7 May 2023 09:27:25 +0200 Subject: [PATCH] sleep with more load --- matrix_pygmalion_bot/bot/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix_pygmalion_bot/bot/core.py b/matrix_pygmalion_bot/bot/core.py index 48d2e5d..1c16232 100644 --- a/matrix_pygmalion_bot/bot/core.py +++ b/matrix_pygmalion_bot/bot/core.py @@ -279,7 +279,7 @@ class ChatBot(object): if datetime.now().hour >= 1 and datetime.now().hour < 5: if not hasattr(self, "last_conversation") or self.last_conversation + timedelta(minutes=30) < datetime.now(): load1, load5, load15 = [x / psutil.cpu_count() * 100 for x in psutil.getloadavg()] - if load5 < 25 and load1 < 25: + if load5 < 40 and load1 < 40: if not hasattr(self, "last_sleep") or self.last_sleep + timedelta(hours=6) < datetime.now(): await self.ai.sleep() self.last_sleep = datetime.now()