-
Notifications
You must be signed in to change notification settings - Fork 162
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
Use 'defer' to simplify handling of AppNetworkStatus pending flags #3468
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3468 +/- ##
=======================================
Coverage 20.29% 20.30%
=======================================
Files 198 198
Lines 45268 45268
=======================================
+ Hits 9188 9192 +4
+ Misses 35396 35393 -3
+ Partials 684 683 -1 ☔ View full report in Codecov by Sentry. |
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.
Maybe use goto instead, e.g. "goto out"? :)
Ok, ok, I'm kidding. Don't throw tomatoes at me. ;)
Currently, we have to remember to set PendingAdd/PendingModify inside AppNetworkStatus to false just before the corresponding handler returns. However, there are few error branches where we forgot to clear the pending flag. This causes zedmanager to just wait and not report the error published inside the AppNetworkStatus. Instead of fixing this case-by-case, let's take advantage of 'defer' to make sure that we will never forget to clear the Pending flag, even if a new branch with return statement is added in the future. Signed-off-by: Milan Lenco <milan@zededa.com>
6533038
to
77460c2
Compare
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.
LGTM
Eden failures are not related this PR and not new. For example, we often get onboarding failure due to error:
To determine why we are getting frequent failures nowadays, we need output from collect-info. For old eden workflow this was added to eden repo here: lf-edge/eden#874 |
Currently, we have to remember to set
PendingAdd
/PendingModify
insideAppNetworkStatus
to false just before the corresponding handler returns (to signal completed operation). However, there are few error branches where we forgot to clear the pending flag (e.g. when IP allocation for VIF fails). This causes zedmanager to just wait and not report the error published inside theAppNetworkStatus
.Instead of fixing this case-by-case, let's take advantage of
defer
to make sure that we will never forget to clear the pending flag, even if a new branch with return statement is added in the future.