From 67540962cf0fc09a65e7b61144daf9c1fc08a708 Mon Sep 17 00:00:00 2001 From: "Michael Pilosov, PhD" Date: Sat, 27 Jan 2024 05:29:39 +0000 Subject: [PATCH] use less CPU --- lazy_serve.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lazy_serve.py b/lazy_serve.py index 5e0ff0a..cfe6dc2 100644 --- a/lazy_serve.py +++ b/lazy_serve.py @@ -2,6 +2,7 @@ import os import signal import subprocess import threading +import time class ServerThread(threading.Thread): @@ -22,6 +23,8 @@ class ServerThread(threading.Thread): self.process.poll() if self.process.returncode is not None: break + else: + time.sleep(0.2) def stop(self): self._stop_event.set()