fix(robot-server): initialize fw update status_cache so we dont hang on bootup when client queries fw updates. #15049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The "instrument firmware update needed" modal was shown on bootup when a firmware update was required. This modal has a "Update Firmware" button that, when pressed, initiates the update for the attached instrument. However, since the updates have already been started internally, pressing the button does nothing until the first update is finished.
The main issue is that the
/subsystem/updates/all
request would hang until the first update was finished for ~2m, this happens because thestart_update_process
function called during bootup would hang waiting onprovide_latest_progress
which itself is waiting on to get a status report onself._status_queue.get()
which blocks. Since thestart_update_process
acquires the_management_lock
, once we callall_ongoing_processes
from the client query we lock until an update is finished.The problem is the "waiting to get the progress" of a specific update process from the hardware controller layer. The
start_update_process
function "queues" the firmware updates by creating the_UpdateProcess
and then running the_update_task
withTaskRunner.run
in the background. This does not guarantee that the update will pass, but, as far as the robot server is concerned the update has been "queued".So what this PR proposes is, when creating the
_UpdateProcess
in the_emplace
method, that we initialize thestatus_cache: UpdateProgress
with a defaultqueued
state. This way we don't block waiting on the response from the hardware controller, and the/subsystem/updates/all
request can return.Closes: RQA-2574
Test Plan
Changelog
Review requests
Risk assessment
Low, but will need additional testing as this touches firmware updates