Skip to content

Commit

Permalink
Fix outdated code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tsagadar committed Nov 10, 2024
1 parent 8f07f2d commit dde0efb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions goosebit/updater/controller/v1/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,33 +125,30 @@ async def deployment_feedback(
await updater.deployment_action_success()
await updater.update_device_state(UpdateStateEnum.FINISHED)

# not guaranteed to be the correct rollout - see next comment.
rollout = await updater.get_rollout()
if rollout:
if rollout.software == reported_software:
rollout.success_count += 1
await rollout.save()
else:
# edge case where device update mode got changed while update was running
logging.warning(
f"Updating rollout success stats failed, software={reported_software.id}, device={updater.dev_id}" # noqa: E501
)

# setting the currently installed version based on the current assigned software / existing rollouts
# is problematic. Better to assign custom action_id for each update (rollout id? software id? new id?).
# Alternatively - but requires customization on the gateway side - use version reported by the gateway.
await updater.update_sw_version(reported_software.version)
logger.debug(f"Installation successful, software={reported_software.version}, device={updater.dev_id}")

elif data.status.result.finished == FeedbackStatusResultFinished.FAILURE:
await updater.update_device_state(UpdateStateEnum.ERROR)

# not guaranteed to be the correct rollout - see comment above.
rollout = await updater.get_rollout()
if rollout:
if rollout.software == reported_software:
rollout.failure_count += 1
await rollout.save()
else:
# edge case where device update mode got changed while update was running
logging.warning(
f"Updating rollout failure stats failed, software={reported_software.id}, device={updater.dev_id}" # noqa: E501
)
Expand Down

0 comments on commit dde0efb

Please sign in to comment.