Skip to content

[Warning] storage.sync 同步限制 #26

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

Open
ishiko732 opened this issue Mar 25, 2025 · 6 comments
Open

[Warning] storage.sync 同步限制 #26

ishiko732 opened this issue Mar 25, 2025 · 6 comments
Labels

Comments

@ishiko732
Copy link
Contributor

storage.sync
如果同步功能处于启用状态,系统会将数据同步到用户已登录的任何 Chrome 浏览器。如果停用,则其行为类似于 storage.local。Chrome 会在离线时将数据存储在本地,并在重新连接到网络后继续同步。配额限制约为 100 KB,即每个项 8 KB。我们建议使用 storage.sync 在同步的浏览器中保留用户设置。如果您要处理敏感用户数据,请改用 storage.session。

@xiaohajiayou
Copy link
Owner

xiaohajiayou commented Mar 25, 2025

  • 目前题目信息同步是用storage.sync,同步策略是让云端和本地数据保持一致,为了绕过单项8kb限制,做了分片存储,100kb总额大概能同步300-400题左右。
  • 查了一下,session的限额好像是5mb,但是清除缓存数据会丢失。
  • 在云端同步reviewlogs的话,感觉5mb可能也不太够,目前有在想看看有没有更好的同步策略。
  • 之前在ts-fsrs的issue里看到,anki好像是只同步最新的题目信息,目前在了解其策略中。

@ishiko732
Copy link
Contributor Author

  • 在云端同步reviewlogs的话,感觉5mb可能也不太够,目前有在想看看有没有更好的同步策略

5MB 大概可以支持12w个logs,但session会丢

@ishiko732
Copy link
Contributor Author

  • anki好像是只同步最新的题目信息,目前在了解其策略中

card取最新,revlogs还是会存储历史信息

@xiaohajiayou
Copy link
Owner

好像session存的是缓存,不会在设备间同步呢。

card取最新,revlogs还是会存储历史信息

感觉如果目的是保持不同设备的本地数据一致,revlogs好像也可以通过日期字段,只上传和拉取最新的数据呢,得再思考一下hhh

@xiaohajiayou
Copy link
Owner

card取最新

目前还是有点困惑,如果云端只存储最新的内容,那么在新设备上好像就没办法同步到全部数据了呢?。

@ishiko732
Copy link
Contributor Author

ishiko732 commented Mar 25, 2025

card取最新

目前还是有点困惑,如果云端只存储最新的内容,那么在新设备上好像就没办法同步到全部数据了呢?。

card是叠加的以往状态的,如果在2台机器都复习了同一张卡这个得看看anki代码.
主要是根据usn字段决定的,核心代码:https://github.com/ankitects/anki/blob/main/rslib/src/sync/collection/changes.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants