Which specific API?
permissions api
Repeating what you already said doesn't really help. There are multiple permissions APIs. Adding/removing/listing, batch/single.
adding /api/permissions which will add record in tc_user_device table
To be more specific POST api for /api/permissions
{
"userId": 2,
"deviceId": 6043
}
Most likely the delay is caused by cache refresh. How many active devices does the device have? And how many users have access to this device?
It is not the device, the user has access to all the device on the platform. So permissions api used to map that device to this master user everytime device is added.
So this user is associated with 1000 device.
While the other user associated with 100 device takes less time.
So if I use same device with other userid the permissions api POST runs quick
But if I use this userid with any device the permissions api POST runs slow
That's expected. It invalidates everything linked to the user.
Meaning, the performance will be deteriorated ? Or some solution has to be found to resolve this delay in POST.
it is taking 50-60 second to submit a postman POST request on /api/permissions.
Isn't that killing
There might be a way to optimize it. If you're interested in sponsoring the work, let me know.
Surprised. you are asking me to sponsor. This is a bug which I tracked down as per your guidance, though not a coder myself. Disappointed to see this message.
A somewhat slow API response is not a bug.
50-60 sec response is considered as somewhat ?
After long debug we found the cache is flushed as and when new devices are added using device api and permissions are mapped using permissions api.
This closes all device ports on server and then connections are established again.
Completely making system unstable.
Commented as guided and it worked well.
However, still the permissions api is taking time for specific userid case when more devices are already associated with the same. eg. userid with 1000 entries with deviceid is taking long time compared to userid with 100 entries .
In case of 4.14 this works smooth in all cases.