Skip to content

Commit

Permalink
fix(robot-server): initialize fw update status_cache so we dont hang …
Browse files Browse the repository at this point in the history
…on bootup when client queries fw updates. (#15049)
  • Loading branch information
vegano1 authored and Carlos-fernandez committed May 20, 2024
1 parent d7c3ba8 commit 21c3e8c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions robot-server/robot_server/subsystems/firmware_update_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 21c3e8c

Please sign in to comment.