One enhancement request for syncing

I am extremely happy with Joplin, everything works as expected, on my iPhone and on my Macs.

Just one thing sometimes goes wrong:

  • I change a note on one device and then quit Joplin before it auto-syncs to my Nextcloud.
  • When I now open Joplin on another device, the changes are (obviously) not there, so when editing the same note there, the earlier changes are ignored
  • Sure, I can remember to manually sync or never close Joplin but sometimes I forget.

Therefore it would be great if there could be an option to always sync when quitting. That would solve it.

Thank you!

Do you normally have the problem that you close the mobile app or the desktop app before it finishes syncing?

The mobile app does not support background sync (it has been a long requested feature, but it is difficult to implement reliably) however it does sync as soon as you start typing, so unless Joplin syncs slowly with you nextcloud, you should be ok to close the app within a few seconds of finishing typing. Also there is a longstanding issue which I have addressed recently in this change Desktop, Mobile: Automatically retrigger the sync if there are more unsynced outgoing changes when sync completes by mrjo118 · Pull Request #12989 · laurent22/joplin · GitHub but you’ll have to wait for Joplin 3.5 for this to be fixed.

The desktop app on the other hand automatically starts syncing 15 seconds after you make a change. The 15 second delay was added due to some kind of issue users were having some years ago, but I’m not sure whether or not it’s still relevant today.

My recollection is a bit hazy but I seem to recall that a delay was needed because Joplin was syncing instantly when something changed. If you typed 100 characters the entire note was being synced 100 times. That was killing data quotas pretty fast.

@HarSel Thank you for your reply. I had not considered this when I developed the PR, so those changes would likely cause higher data usage unfortunately.

I will make a followup PR to address this. I think the logical thing to do would be to always wait 1 second before automatically re-triggering the sync if there are unsynced changes when the sync completes, as the current implementation on mobile waits 1 second before triggering the sync again if you type something after the sync has completed.

FYI the 15 second delay on desktop may have been a separate issue to addressing excessive data usage, because as I mentioned, mobile only has a 1 second delay, and on mobile is where a limited data plan is more likely to be used.

EDIT: I think the 15 second delay on desktop was added because the sync indicator is always visible, so it might be distracting to some people if it’s always spinning when you type (there was mention of this in discussion about it, but it wasn’t sure if this was the main reason or just a secondary reason for it). The way the sync as you type is implemented on desktop is that every time you make another change, it delays the sync another 15 seconds if the sync was already scheduled within the next 15 seconds. So if you are continously typing, you’ll never see the indicator spinning unless you stop typing for at least 15 seconds.

I’ve now created PR All: Avoid excessive data usage when automatically triggering another sync by mrjo118 · Pull Request #13261 · laurent22/joplin · GitHub as a follow up to this

I think you’re right on that. It was distracting for sure and the constant updates were making my NAS work overtime. There’s always going to be those that want/need instant updates and those who can afford to wait a few minutes before syncing. I’m in the latter category.

If Joplin starts syncing 15 seconds after making a change, then what’s the point of Synchronization interval setting?

Laptop users like me would appreciate having “Offline mode” setting, which would disable automatic synchronization of notes, since that’s not possible when PC is disconnected from internet.

The interval is used to pull changes made on other devices.

1 Like

Yeah, that’s not possible. Is there a particular reason you would like an offline mode? I think the intention is that automatically syncing outgoing changes while you type means that if a note conflicts, as long as your internet is connected, then you will get the conflict shortly after you start editing an outdated note, rather than after some time of editing. The incoming change interval is presumably configurable so at least Joplin can sync to your preference if you’re just reading your notes

I understand that not everybody would need this, so an option would be great.

For Mac/PC I still think an option to sync upon quitting would solve this.

On iOS/mobile I understand it, as they do not quit when you switch out of the app. And i can see how a constant sync would make the user experience suboptimal.

So background syncing does not happen with Joplin, even if you allow background activity for the app?

Correct.

With regards to the desktop app, doing a sync on exiting would probably be more viable to implement, but it would need to have a time limit on how long the closing sync could run for (eg. 15-30 seconds) to ensure the app will actually be closed.

Could you not do it like Chrome or other browsers do it? Upon Command+Q, a message that there are unsynced elements and ask the user if they really want to quit (by pressing Command+Q again).

The desktop app on the other hand automatically starts syncing 15 seconds after you make a change. The 15 second delay was added due to some kind of issue users were having some years ago, but I’m not sure whether or not it’s still relevant today.

Sorry, just seeing this now.

If a sync happens automatically after 15 sec, why is there a preference to sync after 5 min?

Potentially, but certain sync issues which are not apparent in the sync result would result in the prompt opening either during a temporary window, or every time Joplin is closed (as there is no way to detect the specific problem other than to actually run the sync), which might cause confusion to the user if there is no apparent problem.

In particular, this scenario in the code:

If a sync happens automatically after 15 sec, why is there a preference to sync after 5 min?

As mentioned in other responses in this thread, the sync interval configured there is used to pull changes made on other devices, where as the ‘sync as you type’ is to push changes

In order to ensure, that all local changes are synced, it’s not necessary to perform full sync on exit. Executing those scheduled 15sec delayed updates in advance would be enough and much faster to perform.

Sure, but a time limit to sync on exit would still be needed as the speed of a partial sync would vary depending on the speed of the sync target and if revisions have been created / deleted etc

How about a simple red dot showing “You have unsynced local changes”? That would help my use case.

You can download this plugin which does something comparable to that:

After installing it, go to extra markdown settings and for the ‘show visual sync indicator’ option select either with an icon or with text. Then in the editor, there will be an indicator in the top right when there are un-synced changes

That does not seem to work for me (I am mostly using Rich Text Editor on MacOS).

By the way, I switched over from Simplenote a while ago. I like Joplin much better, so cheers for that.

However Simplenote did the syncing over devices perfect, almost in real-time, and never lost a version/edit.

Ah yeah, unfortunately the sync indicator won’t work for the Rich Text Editor

1 Like