Use signal.pause() instead of while True to keep Linspector running. A while True loop starts using 100% of one CPU when there is no sleep() inserted. That's not a good way to keep a program running. (0.20.3)

This commit is contained in:
Johannes Findeisen 2023-02-22 17:14:02 +01:00
commit 3078d125e8
2 changed files with 4 additions and 5 deletions

View file

@ -8,6 +8,7 @@ See LICENSE.txt (MIT license).
# Only exit execution on critical core errors. Do not exit when monitors are failing on
# configuration and execution, but log these errors.
import argparse
import signal
import sys
from linspector.core.configuration import Configuration
@ -16,7 +17,7 @@ from linspector.core.linspector import Linspector
from linspector.core.logger import Log
from linspector.core.monitors import Monitors
__version__ = '0.20.2'
__version__ = '0.20.3'
__author__ = 'Johannes Findeisen <you@hanez.org>'
@ -101,8 +102,7 @@ def main():
sys.exit(1)
else:
try:
while True:
pass
signal.pause()
except KeyboardInterrupt:
log.info('[linspector] program terminated by user!')

View file

@ -129,5 +129,4 @@ class Linspectord:
# while development because the daemon even runs when internally is nothing to do.
@staticmethod
def run():
while True:
pass
signal.pause()