in utils/ci_iot_thing.py [0:0]
def wait(self, thing_name):
start = time.monotonic()
sleep = self._delay
while True:
try:
resp = self._client.list_thing_principals(thingName=thing_name)
except ClientError as e:
if e.response["Error"]["Code"] == "ResourceNotFoundException":
return
raise
if not resp.get("principals"):
# No principals, we can move on.
return
if time.monotonic() - start > self._timeout:
raise WaiterError(
name="ThingDetached",
reason="timeout",
last_response=resp,
)
time.sleep(sleep)
sleep = min(sleep * 1.6, self._max_delay) # exponential backoff on retrys