会话变更自动同步#444
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
变更
事件接入与后台调度
autoSync.onConversationChanged(...),把 upsert、消息写入、图片回填和 comments 增删改移都转成按conversationId的入队事件。background-services按 provider 的自动同步开关和 sync-provider gate 决定是否入队;写入侧用fireAndForget,避免同步调度拖慢主写入链路。createAutoSyncSchedulerCore统一处理去重、去抖、队列上限、最近到期 alarm 和 flush;当 sync 已在运行时会把到期项重新延后,避免并发重入。parent_page_id,失败时落一条可见的失败 job,避免静默丢失同步结果。设置与运行时契约
wxt.config.ts增加alarms权限,让 MV3 可以在 debounce 到期后唤醒并 flush 队列。conversationId的契约说明。测试