Dateien hochladen nach „REST“

wrong path fix
main
Thomas Hassenstein 2023-06-13 22:46:44 +02:00
parent b1b667f4e0
commit 724b8a8b68
1 changed files with 8 additions and 1 deletions

View File

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