devicehive-java-server
devicehive-java-server copied to clipboard
Improve concurrency handling logic on multiple device registration
When registering 2+ devices with the same deviceClass (but ids and keys are unique) with the minimum delay between each registration request an error is returned with the status code 409.
Examples can be found in the issue description for .net server
Example of the response returned by java server:
{
"error":null,
"message":"Error occurred. Please, retry again"
}
Possible solutions/impovements:
- Add additional information to the returned error object specifying the exact case. Add description of how to handle concurrency issues to the doc.
- Set up pessimistic concurrency for this request. Because data in the device, device_class, equipment, device_equipment is not changed to often, performance is not an issue for the device registration flow.
- Add some specific for this case workarounds. For instance - do not update device_class, equipment, device_equipment if the data is the same, etc.