Hi guys, I started developing the creation of machines remotely via API requests, but I found a moment that when asynchronously connected to the controller and the model, after receiving a response, the function still freezes for 10 seconds, please tell me what can be done?
That is, with any connection to the controller, regardless of what data I want to get, the session still hangs for 10 seconds.
I tried to use the built-in disconnect method, and also tried to interrupt the asynchronous function, but there is no result. Used the [pythonlibjuju](https://pythonlibjuju.readthedocs.io/en/latest /)
the asynchronous function looks like this, this function gets the data of all parameters that are specified inside the model
async def application_data(data_js):
controller = Controller()
model = Model()
try:
await asyncio.gather(controller.connect(data_js['controller_name']), model.connect(str(data_js['controller_name']) + ':admin/' + str(data_js['model_name'])))
array = []
try:
for app in model.applications:
for unit in Application(model=model, entity_id=app).units:
array.append(unit.data)
source_data = json.dumps(array, indent=4)
print("SOURCE - DATA", source_data)
return source_data
except JujuAppError:
source_data = "Applications Errors"
return source_data
except JujuConnectionError:
source_data = ("Connection Errors")
return source_data
finally:
await model.disconnect()
return source_data