Skip to content

Commit 025b192

Browse files
committed
add sleep
1 parent 0298e2e commit 025b192

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

unit-tests/live/config/test-device-hub.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@
2828
# -------- Disconnect detection via hardware reset --------
2929
test.start("device_hub: detect disconnect after hardware_reset")
3030
caught_once = False
31+
attempt = 1
3132

32-
for attempt in range(1, MAX_TRIES + 1):
33+
while not caught_once and attempt <= MAX_TRIES:
3334
try:
3435
log.i(f"Attempt {attempt}/{MAX_TRIES}: issuing hardware_reset()")
3536
dev.hardware_reset()
37+
attempt += 1
3638

3739
# Wait until hub reports this handle as disconnected
3840
t = time.time()
3941
while time.time() - t < DISCONNECT_TIMEOUT_SEC:
4042
if not hub.is_connected(dev):
4143
caught_once = True
4244
break
43-
44-
if caught_once:
45-
break
45+
time.sleep(0.1)
4646

4747
except:
4848
test.unexpected_exception()

0 commit comments

Comments
 (0)