immich icon indicating copy to clipboard operation
immich copied to clipboard

[BUG] Mobile app: Backup settings page takes a long time to load state

Open bo0tzz opened this issue 3 years ago • 6 comments

When the mobile app's backup_controller_page is initializing, one of the steps in getting its state involves loading the list of local albums that are present on the device. This is implemented in _getBackupAlbumsInfo() simply by looping through all the albums on the device. This process happens synchronously when instantiating the backup settings view. Something about it is very slow, and as it blocks the loading of the state, it takes quite a while for the view to be loaded properly (displaying incorrect settings, counts, etc until then).

The exact reason for the slowness is unclear. It could be in our code, but the photo_manager library we use is also suspicious. As one example, the PhotoManager.getAssetPathList() function loops through all the assets in order to get a total asset count. To determine the exact cause of the slowness, actual profiling would be desired.

Regardless of the reason this album loading process is slow though, there are some steps we can take to mitigate it. This would include for example caching the local albums data and/or loading it asynchronously separate from the other backup state. People who are more familiar than me with the mobile app code might have other ideas as well.

All of the above is based on Android. I do not know whether the iOS app has this issue as well.

bo0tzz avatar Oct 16 '22 16:10 bo0tzz

I am experiencing the very same issue on iOS. As soon as I go to the page to select the albums for backup, the loading indicator is displayed and the page never finishes loading. My photo Library contains ~340GB of data in ~50 Albums.

I've tried to keep the page open (and prevented the phone from sleeping) for more than 15 minutes. Even this long time wasn't enough to finish loading.

gorootde avatar Nov 04 '22 17:11 gorootde

@gorootde Do you have those photos on iCloud with the Optimized Storage setting enabled?

alextran1502 avatar Nov 04 '22 18:11 alextran1502

Yes I do.

gorootde avatar Nov 04 '22 19:11 gorootde

@gorootde So that means the photos are not on the device. That is why the scan result doesn't show any. The app currently works with photos and videos physically on the device.

alextran1502 avatar Nov 04 '22 19:11 alextran1502

Thanks for pointing that out. I assumed because of this comment that it works (but is slow). However, not even the photos which are physically on my device (e.g. a photo taken a few seconds ago) show up. I assume this is the expected behaviour until #477 is fixed

gorootde avatar Nov 04 '22 20:11 gorootde

Thanks for pointing that out. I assumed because of this comment that it works (but is slow). However, not even the photos which are physically on my device (e.g. a photo taken a few seconds ago) show up. I assume this is the expected behaviour until #477 is fixed

@gorootde I thought so too but apparently not.

alextran1502 avatar Nov 04 '22 23:11 alextran1502

I experienced this, and if I type in the search bar and then clear the query then all the results show.

eygraber avatar Sep 04 '23 11:09 eygraber

I believe this is solved now thanks to #3905.

EnochPrime avatar Sep 20 '23 15:09 EnochPrime