Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force syncing of media after import #214

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

aplaice
Copy link
Collaborator

@aplaice aplaice commented Sep 15, 2024

Otherwise, if in the source CrowdAnki decks a file has only been edited, this won't be synced to other devices.

By default, Anki only checks whether it should more expensively check for changes to individual media files if the mtime of the entire media directory has changed.

(According to the docs:

https://docs.ankiweb.net/syncing.html#media

It will notice when media has been added, removed or replaced in
your media folder, but will not notice if you have made edits to
existing files.

However, the mechanism by which it checks for this is via the directory is (currently!) via the mtime of the dir:

https://github.com/ankitects/anki/blob/b7cb0c0d0081202586fd2d88541db962819736b3/rslib/src/sync/media/database/client/changetracker.rs#L94

)

Note that this means that every time CrowdAnki imports a deck, with media, Anki will have to perform the more expensive check.

The cost of this "second" check was deemed sufficiently high that the current behaviour (of two checks) was (re-)introduced here:

ankitects/anki@35cbde6

However, given that importing CrowdAnki decks is not a frequent occurrence (probably less frequent than adding new media files oneself — which also triggers the "second" check), this is a worthwhile change.

For background see here:

anki-geo/ultimate-geography#638 (comment)

@aplaice aplaice added the import label Sep 15, 2024
Otherwise, if in the source CrowdAnki decks a file has only been
edited, this won't be synced to other devices.

By default, Anki only checks whether it should more expensively check
for changes to individual media files if the mtime of the entire media
directory has changed.

(According to the docs:

https://docs.ankiweb.net/syncing.html#media

> It will notice when media has been added, removed or replaced in
> your media folder, but will not notice if you have made edits to
> existing files.

However, the mechanism by which it checks for this is via the
directory is (currently!) via the mtime of the dir:

https://github.com/ankitects/anki/blob/b7cb0c0d0081202586fd2d88541db962819736b3/rslib/src/sync/media/database/client/changetracker.rs#L94

)

Note that this means that every time CrowdAnki imports a deck, with
media, Anki will have to perform the more expensive check.

The cost of this "second" check was deemed sufficiently high that the
current behaviour (of two checks) was (re-)introduced here:

ankitects/anki@35cbde6

However, given that importing CrowdAnki decks is not a frequent
occurrence (probably less frequent than adding new media files oneself
— which also triggers the "second" check), this is a worthwhile
change.

For background see here:

anki-geo/ultimate-geography#638 (comment)
@aplaice aplaice merged commit a750d7b into Stvad:master Sep 15, 2024
2 checks passed
@aplaice aplaice deleted the force_media_sync_on_import branch September 16, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants