Azure-Samples / digital-twins-samples

Azure Digital Twins building scenario sample code
MIT License
105 stars 88 forks source link

Setup (with SetupBuildingScenario) fails intermittently due to eventually consistency of datastore #73

Open stewartadam opened 3 years ago

stewartadam commented 3 years ago

Initializing a new ADT instance using SetupBuildingScenario can sometimes fail because of the eventual consistency in the backing datastore.

I tried a few times today and saw different errors at different points:

  1. sometimes, it claims that fields on the twin are not valid according to the model, despite the model having them (it seems the model was created, but not yet made available by backend yet so it thought the fields didn't exist)
  2. other times, the initial twin creation was successful but creating the relationships failed, claiming the twins did not exist yet (despite just having been created).

In either case, if I captured the net-traces using tools like mitmproxy, re-running the same REST call a few seconds later worked.

I suggest the sample introduce small delays between model creation, twin creation, and relationship creation to avoid this.