devicehive-java-server icon indicating copy to clipboard operation
devicehive-java-server copied to clipboard

Improve concurrency handling logic on multiple device registration

Open sorjef opened this issue 11 years ago • 0 comments

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.

sorjef avatar Dec 23 '14 12:12 sorjef