Feature suggestion: Mobile: Change default attachment download behavior from "Always" to "Automatic"

Currently, decryption happens on the main thread. As such, downloading resources in parallel gives the DecryptionWorker more to decrypt (and thus decryption of everything may be slower).

I also suspect that downloading resources in parallel to notes/notebooks makes downloading sync slower because of rate limiting.

Another option would be to sync notes and notebooks first, then resources. (Though if a user opens a just-decrypted note, perhaps its resources could be downloaded sooner.)

But does it really make sync slower?

I'm currently testing this.

  • Without resources, a full sync (iOS/OneDrive/E2EE) takes roughly 6 minutes.
  • With resources, a sync of all notes takes roughly 8 minutes. Resources continue to download after that however (still downloading 25 minutes later).

So it seems that sync times are similar.

A note on background sync

There is at least one library available that may do background sync (or something similar):

I wasn't able to get it to start a background task though (perhaps the version of the library I was using wasn't compatible with the version of React Native Joplin uses?).

A while back, there was also a pull request that implemented background sync natively, though just for Android.

The difficulties here are:

  1. Running a task in the background.
  2. If background sync runs at the same time as the main application, it could cause data corruption (Joplin makes the assumption that only one instance of the application is running at a time).
    • Thus, also canceling the background sync task when Joplin comes to the foreground and resuming it/starting a new one when Joplin goes to the background.

There seems to be a library available from the same project that prevents the screen from sleeping:

Thus, a simpler alternative could be to have an "initial sync" screen that keeps the screen on.

1 Like