Feature request: Background sync

Hello,
I’m another satisfied anki desktop (and iOS) user.

When I clic on sync, a popup appear which is, imho not really useful. And when I activate sync on open / close (Settings > Network > Automatically sync profile on open / close), I have the same behavior.

I’m wondering if this popup, which have no value from the user perspective, can be removed and the sync is done in the background.

What do you think ? Thanks.

TLDR; Feature request

The sync that can be done in background is actually done in background (ie. media syncing). I think that, while the pop-up is on, it means that it’s reading / writing to Anki’s database, and it would cause a data race to access it in the meantime (for instance by: review, browsing cards, adding cards, editing cards, creating / deleting a deck, exporting or importing anything — basically, anything the user may want to do while Anki is syncing), which is why the pop-up is there: to prevent the user from actually doing something.

4 Likes

I assume it’s there to ensure data integrity during sync so that a single process is handling the data during this important process.

In over a decade using Anki, I haven’t had one single occurrence of data corruption so I’d vote to keep it as-is.

1 Like

Blocking Anki usage during sync make sense, but still I find this popup very ennoying and I feel like this is something that can be improved.

Using anki during sync is not that hard, there are some solutions that can be implemented (i.e sync a clone of the DB, or simply use a stack of update that need to be done after the sync).

I.E Google doc sync is in the background and it’s 100% automatic, you don’t have to care about it it just works.

I’d like Anki to provide the same experience to its users.

There’s a big difference between a text document of a few kB and a database of dozens or hundreds of MB.
Also, when your Google doc ‘syncs’, it’s just streaming a copy to the cloud. On the other hand, when Anki syncs it is likely to receive relevant updates. Say you’ve done some reviews on another device. If Anki let you proceed to study before the sync is complete, you would end up doing these reviews twice.

3 Likes

It may not seem like such, but shared memory access is an extremely complicated topic, which has lead to an unimaginable amount both of bugs and of research, leading to extremely complex solutions. I wouldn’t be surprised if google’s database code base dedicated to handling synchronization was bigger than Anki’s entire code base.

Actually, google docs kind of handles the same issue, because when two users modify the same part of a document, due to the delay in the synchronization with google, the server has to decide on the fly how to merge these, and it has to do that very efficiently; and, just like with Anki’s sync you can receive modifications from upstream, Google Docs too can receive modifications, not only send them.

1 Like

I’m sure it can and has some way of dealing with conflicts, but it’s not something the average user experiences. My point was that it feels so seamless, because it’s usually tiny one-way pushes in practice.

Mhh… not sure about that (maybe they just handle merges very well), but I see your point and, indeed, it could be true…