From 724b8a8b6832720c20eceb29487817a8e3d78930 Mon Sep 17 00:00:00 2001 From: Thomas Hassenstein <2021544@stud.hs-mannheim.de> Date: Tue, 13 Jun 2023 22:46:44 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20hochladen=20nach=20=E2=80=9EREST?= =?UTF-8?q?=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wrong path fix --- REST/app.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/REST/app.py b/REST/app.py index 2978dd2..4e00f51 100644 --- a/REST/app.py +++ b/REST/app.py @@ -25,9 +25,16 @@ def initialize_generator(): if initialized: return create_response(200, 'System is already initialised, random numbers can be requested') + start_time = time.time() with lock: # Sperre (Lock) verwenden, um sicherzustellen, dass nur ein Thread die Methode ausführt result = analyze_data(int(1), int(1), startup=True) - + + end_time = time.time() + duration = end_time - start_time + + if duration > 60: + return create_response(555, 'Unable to initialize the random number generator within a timeout of 60 seconds') + else: if result is True: initialized = True return create_response(200, 'Successful operation; random number generator is ready and random numbers can be requested')