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')