From c163426e7effb16cbb314b810de5c61f8945c93e Mon Sep 17 00:00:00 2001 From: Brayan Almonte Date: Tue, 30 Apr 2024 16:56:50 -0400 Subject: [PATCH] fix(robot-server): initialize fw update status_cache so we dont hang on bootup when client queries fw updates. (#15049) --- .../robot_server/subsystems/firmware_update_manager.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/robot-server/robot_server/subsystems/firmware_update_manager.py b/robot-server/robot_server/subsystems/firmware_update_manager.py index 12aacc4feb4..43394e972ee 100644 --- a/robot-server/robot_server/subsystems/firmware_update_manager.py +++ b/robot-server/robot_server/subsystems/firmware_update_manager.py @@ -139,12 +139,13 @@ def __init__( created_at: datetime, update_id: str, complete_callback: Callable[[], Awaitable[None]], + status_cache: Optional[UpdateProgress] = None, ) -> None: """Build an _UpdateProcess. Should only be done by the manager.""" self._status_queue = Queue() self._hw_handle = hw_handle self._subsystem = subsystem - self._status_cache = None + self._status_cache = status_cache self._status_cache_lock = Lock() self._created_at = created_at self._update_id = update_id @@ -346,7 +347,12 @@ async def _complete() -> None: log.exception(f"Double pop for update on {subsystem}") self._all_updates_by_id[update_id] = _UpdateProcess( - self._hardware_handle, hw_subsystem, creation_time, update_id, _complete + self._hardware_handle, + hw_subsystem, + creation_time, + update_id, + _complete, + UpdateProgress(UpdateState.queued, 0, None), ) self._running_updates_by_subsystem[hw_subsystem] = self._all_updates_by_id[ update_id