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

Fixes a bug causing Updates to get stale #2850

Merged
merged 7 commits into from
Sep 18, 2024
Merged

Conversation

shubham1g5
Copy link
Contributor

@shubham1g5 shubham1g5 commented Sep 17, 2024

Summary

https://dimagi.atlassian.net/browse/SC-3923

Bug Fix for App updates.

Background updates were failing due to SessionNotAvailable exception due to us unneccesarily checking for user session being active in the Update Worker. This PR makes 2 important changes to eliminate this -

  1. Remove the check for user session from UpdateWrapper, we already perform user updates outside user sessions.
  2. If the error is caused by the wrapper code in UpdateWorker, we can simply result a task failure instead of handling it as an update code error and resetting the update downloads.

Safety Assurance

  • If the PR is high risk, "High Risk" label is set
  • I have confidence that this PR will not introduce a regression for the reasons below
  • Do we need to enhance manual QA test coverage ? If yes, "QA Note" label is set correctly

Automated test coverage

Covered in UpdateWorkerTests

Safety story

Mostly relying on tests coverage here plus the change not affecting any functional update code.

cross-request: dimagi/commcare-core#1438

@avazirna avazirna added this to the 2.54.1 milestone Sep 17, 2024
// skip if - An update task is already running | no app is seated | user session is not active
if (UpdateTask.getRunningInstance() == null &&
CommCareApplication.instance().currentApp != null &&
CommCareApplication.instance().session.isActive) {
Copy link
Contributor

Choose a reason for hiding this comment

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

just a clarification, in the previous version, in case there was no active user session the result would be success, so what was causing the errors when there was no active session?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the call to CommCareApplication.instance().session.isActive would itself error out with a SessionUnavailableException

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh yes, I see it now

@shubham1g5
Copy link
Contributor Author

@damagatchi retest this please

@shubham1g5
Copy link
Contributor Author

Only test failure was DateWidgetTests which is independent of the changes here. Merging without getting a build pass here.

@shubham1g5 shubham1g5 merged commit d827345 into commcare_2.54 Sep 18, 2024
1 check failed
@shubham1g5 shubham1g5 deleted the updateFix branch September 18, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants