deltachat / deltachat-android

Email-based instant messaging for Android.
GNU General Public License v3.0
1.14k stars 147 forks source link

Account deletion confirmation dialog takes a while to appear in big accounts #3308

Open adbenitez opened 1 month ago

adbenitez commented 1 month ago

this is because the computation of the account size takes a few seconds, maybe display "..." or "--" there and make the core API call in a thread to load dynamically? what will happen if user click "delete" button and the API call didn't returned yet?? (cc @link2xt)

other option would be not to display the account size, but it is nicer to know

iequidoo commented 1 month ago

get_account_file_size() (if it's what is used) can fail, but nothing else should happen (i.e. it shouldn't deadlock or so). Still, it makes sense to wait when it finishes before closing the dialog window.

link2xt commented 1 month ago

It is fine to remove the account even without waiting for get_account_file_size to return. It should not interfere with removing an account on Linux/Android. Size calculation may fail if you are quick enough and remove the database before get_account_file_size gets to it, so ignore any errors.

Unlike Windows, Linux may only fail to delete files if they are backing executable part of the running process, but we don't execute anything from the account folder. This is actually fixed in recent Linux 6.11 (https://lwn.net/Articles/866493/), but Android will take forever to upgrade, so it's just a fun fact.