Issue/backup restore reduce fetch delay#13944
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APK here. |
ParaskP7
left a comment
There was a problem hiding this comment.
👋 @zwarm !
I have reviewed and tested this PR as per the instruction, good job! 🌟
Warning (GetRestoreStatusUseCase is running indefinitely when there is no restore in progress and the activity log screen launches. This is due to the fact that the activityLogStore.getRewindStatusForSite(site)?.rewind returns as null within the GetRestoreStatusUseCase and since it is null it never enters the next if statement, then the loop starts over resulting in the same output.
I am not sure when this was introduced or whether we missed that from the very beginning, but I am confident that if we add the emit(Empty) logic on this use case, just like we did on the getBackupDownloadStatus(...), everything will work fine. I actually tried it myself and it indeed works okay. Wdyt?
GetRestoreStatusUseCase
val rewind = activityLogStore.getRewindStatusForSite(site)?.rewind
if (rewind == null) {
emit(Empty)
return@flow
}
if (restoreId == null || rewind.restoreId == restoreId) { ... }
RestoreViewModel
private fun handleQueryStatus(restoreStatus: RestoreRequestState) {
when (restoreStatus) {
...
is Empty -> transitionToError(RestoreErrorTypes.RemoteRequestFailure)
else -> ...
}
}
@ParaskP7 - 🤦 Wow, this was a great catch. I addressed as you suggested and added a new test in the |
…wordpress-mobile/WordPress-Android into issue/backup-restore-reduce-fetch-delay
| } | ||
|
|
||
| @Test | ||
| fun `given get status model is null, when restore status triggers, then return empty`() = test { |
There was a problem hiding this comment.
Minor (🔍): Consider adding a test for the without restore id case. All the tests above are duplicated to with restore id and without restore id. Maybe we should keep that pattern for this test as well.
PS: After the so many update we did on this use case maybe the with and without restore id is no longer necessary. But, before deleting and consolidating these and the Backup Download related test, I would keep consistency first.
PSS: Feel free to ignore this comment.
There was a problem hiding this comment.
PS: After the so many update we did on this use case maybe the
withandwithoutrestore id is no longer necessary.
I didn't think it was necessary, so I started on the road to eliminating it; however for this PR I will stay consistent. I added in the null restoreId test. :)
There was a problem hiding this comment.
Thank you @zwarm ! 🌟
Yes indeed, I think it is no longer necessary and we can do an cleanup with our Restore and Backup Download use case tests next week when we will get the chance to do it.
PS: LGTM, feel free to merge this PR when it is ready.
Parent #13328 & #13329
Merge Instructions:
To test:
PR submission checklist:
RELEASE-NOTES.txtif necessary.