0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

enable for all posix

This commit is contained in:
2025-12-15 15:26:38 +01:00
parent a2a89eb573
commit d13e404d30

View File

@@ -152,14 +152,14 @@ class ModuleManager:
assert spec.loader assert spec.loader
try: try:
start = time.perf_counter() start = time.perf_counter()
if sys.platform == "linux": if os.name == "posix":
def handler(signum, frame): raise TimeoutError("Module loading timed out") def handler(signum, frame): raise TimeoutError("Module loading timed out")
signal.signal(signal.SIGALRM, handler) signal.signal(signal.SIGALRM, handler)
signal.alarm(5) signal.alarm(5)
try: spec.loader.exec_module(module) try: spec.loader.exec_module(module)
except TimeoutError: self.logger.error(f"Module {module_name} took too long to load and was skipped.") except TimeoutError: self.logger.error(f"Module {module_name} took too long to load and was skipped.")
finally: finally:
if sys.platform == "linux": signal.alarm(0) if os.name == "posix": signal.alarm(0)
if (time_took := time.perf_counter() - start) > 0.15: self.logger.warning(f"{module_name} took {time_took:.1f}s to start") if (time_took := time.perf_counter() - start) > 0.15: self.logger.warning(f"{module_name} took {time_took:.1f}s to start")
except Exception as e: except Exception as e:
traceback.print_exc(file=self.logger.output) traceback.print_exc(file=self.logger.output)