tizi: fix panda amp race condition (#33895)

* backoff

* bump panda

* cleanup

* fix mypy

---------

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Adeeb Shihadeh
2024-10-30 17:04:05 -07:00
committed by GitHub
parent b470bef140
commit 25d2555e49
2 changed files with 5 additions and 3 deletions
+1 -1
Submodule panda updated: 352e7ff138...0b364ece1e
+4 -2
View File
@@ -125,13 +125,15 @@ class Amplifier:
def set_configs(self, configs: list[AmpConfig]) -> bool:
# retry in case panda is using the amp
tries = 15
for i in range(15):
backoff = 0.
for i in range(tries):
try:
self._set_configs(configs)
return True
except OSError:
backoff += 0.1
time.sleep(backoff)
print(f"Failed to set amp config, {tries - i - 1} retries left")
time.sleep(0.02)
return False
def set_global_shutdown(self, amp_disabled: bool) -> bool: