Skip to content

Conversation

@al1img
Copy link
Collaborator

@al1img al1img commented Nov 5, 2025

No description provided.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 90.06623% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.04%. Comparing base (d140799) to head (ed6e1a0).

Files with missing lines Patch % Lines
src/core/cm/updatemanager/unitstatushandler.cpp 83.88% 39 Missing ⚠️
src/core/cm/updatemanager/updatemanager.cpp 74.07% 14 Missing ⚠️
.../cm/updatemanager/tests/mocks/imagemanagermock.hpp 50.00% 3 Missing ⚠️
...re/cm/updatemanager/tests/mocks/unitconfigmock.hpp 33.33% 2 Missing ⚠️
...c/core/cm/updatemanager/tests/stubs/senderstub.hpp 90.90% 1 Missing ⚠️
src/core/cm/updatemanager/tests/updatemanager.cpp 99.63% 1 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##           feature_unification     #403      +/-   ##
=======================================================
+ Coverage                77.68%   78.04%   +0.36%     
=======================================================
  Files                      236      248      +12     
  Lines                    23042    23681     +639     
  Branches                  3436     3516      +80     
=======================================================
+ Hits                     17901    18483     +582     
- Misses                    5141     5198      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 5, 2025


const UnitStatus& WaitSendUnitStatus()
{
std::unique_lock lock(mMutex);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
std::unique_lock lock(mMutex);
std::unique_lock lock{mMutex};

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

*/
Error SendUnitStatus(const UnitStatus& unitStatus) override
{
mUnitStatus = unitStatus;
Copy link
Member

Choose a reason for hiding this comment

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

consider adding lock_guard at the begining

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

{
LockGuard lock {mMutex};

if (auto err = mNodeInfoProvider->SubscribeListener(*this); !err.IsNone()) {
Copy link
Member

Choose a reason for hiding this comment

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

not sure if the case is possible, but what if mImageStatusProvider->SubscribeListener(*this) fails,
and Start is called one more time, mNodeInfoProvider->SubscribeListener(*this); is likelly to return AlreadyExists error.

Should this case be handle somehow, by adding DefferRelease, or checkong errors for AlreadyExists enum

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In out case if Start fails, we close whole application and systemd restarts it. So, we should either handle this scenario in all the cases or leave it as is.


LogUnitStatus();

// Send unit status
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a redundand comment

Suggested change
// Send unit status

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

return;
}

itemIt = mUnitStatus.mUpdateItems->end() - 1;
Copy link
Member

Choose a reason for hiding this comment

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

This way looks less magic :)

Suggested change
itemIt = mUnitStatus.mUpdateItems->end() - 1;
itemIt = &mUnitStatus.mUpdateItems->Back();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agree, fixed

return;
}

itemIt = mUnitStatus.mInstances->end() - 1;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

return;
}

instanceIt = itemIt->mInstances.end() - 1;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

return AOS_ERROR_WRAP(err);
}

it = mUnitStatus.mInstances->end() - 1;
Copy link
Member

Choose a reason for hiding this comment

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

ditto

mUnitStatus.mUnitSubjects.Reset();
};

void UnitStatusHandler::StartTimer()
Copy link
Member

Choose a reason for hiding this comment

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

Does this implementation restart timer on each call like in Go it does, to wait some time for new updates before sending?

We need two times more update items in unit status to have already installed
status and new item status.

Signed-off-by: Oleksandr Grytsov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants