Friday, 24 June 2022

AWS IOT Inconsistent results from multiple sequential requests

I'm writing a simple unittest which is running:

botocore.client.IoT.search_index(queryString='connectivity.connected:true')

My unittest simply connects a device, subscribes to MQTT, sends and receives a test message. This gives me reason to trust the device is truly online.

Sometimes my unit test passes, sometimes fails. When I come into a debugger and run the search_index command repeatedly I see inconsistent results between calls. Sometimes the device I just connected is online, sometimes it's not, after 20ish seconds the device appears to be consistently online.

I believe I'm probably getting responses from different servers and the propagation of the connected state between servers is simply delayed on the AWS side.

If my assessment is correct, then I want to know if there's anything I can do to force a consistent state between calls. Coding around this kind of inconsistent behavior is extremely error prone and almost certain to induce very hard to track bugs. Plus I don't trust that many other requests I'm making to AWS IOT are safe to rely on. In short I'm not going to do it, I'll find a better solution if there's no way to force AWS IOT to provide a consistent state between calls.



from AWS IOT Inconsistent results from multiple sequential requests

No comments:

Post a Comment