parent
b1b667f4e0
commit
724b8a8b68
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue