added the one hour limit to compilation as well

This commit is contained in:
Karma Riuk
2025-03-07 08:59:50 +01:00
parent 9fa7dd53af
commit 3a5cd998fd

View File

@ -60,6 +60,13 @@ class BuildHandler(ABC):
return False
def compile_repo(self) -> bool:
def timeout_handler(signum, frame):
raise TimeoutError("Tests exceeded time limit")
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(3600) # Set timeout to 1 hour (3600 seconds)
try:
exec_result = self.container.exec_run(self.compile_cmd())
output = clean_output(exec_result.output)
if exec_result.exit_code != 0:
@ -69,6 +76,13 @@ class BuildHandler(ABC):
self.updates["compiled_successfully"] = True
return True
except TimeoutError:
self.updates["compiled_successfully"] = False
self.updates["error_msg"] = "Compile process killed due to exceeding the 1-hour time limit"
return False
finally:
signal.alarm(0) # Cancel the alarm
def test_repo(self) -> bool:
def timeout_handler(signum, frame):