-
Notifications
You must be signed in to change notification settings - Fork 6
Send unit status #403
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
base: feature_unification
Are you sure you want to change the base?
Send unit status #403
Conversation
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
|
|
|
||
| const UnitStatus& WaitSendUnitStatus() | ||
| { | ||
| std::unique_lock lock(mMutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| std::unique_lock lock(mMutex); | |
| std::unique_lock lock{mMutex}; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
| // Send unit status |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 :)
| itemIt = mUnitStatus.mUpdateItems->end() - 1; | |
| itemIt = &mUnitStatus.mUpdateItems->Back(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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]>
Signed-off-by: Oleksandr Grytsov <[email protected]>
Signed-off-by: Oleksandr Grytsov <[email protected]>
Signed-off-by: Oleksandr Grytsov <[email protected]>
Signed-off-by: Oleksandr Grytsov <[email protected]>
ed6e1a0 to
5b18362
Compare



No description provided.