Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent retries #8

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/nerves_hub_link_common/update_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ defmodule NervesHubLinkCommon.UpdateManager do

@spec maybe_update_firmware(UpdateAvailable.t(), State.t()) ::
State.download_started() | State.download_rescheduled() | State.t()
defp maybe_update_firmware(%UpdateAvailable{update_available: false}, %State{} = state) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it also bail early if the :update_available key doesn't exist? Isn't that a possible case prior to your NH fix? Like would this affect people running NH servers and who aren't syncing with upstream regularly?

# if the `update_available` key is false, bail early. There is no update
state
end

defp maybe_update_firmware(_data, %State{status: {:updating, _percent}} = state) do
# Received an update message from NervesHub, but we're already in progress.
# It could be because the deployment/device was edited making a duplicate
Expand Down