Skip to content

feat: optimize fresh device conversation sync#3740

Open
redflyingfish wants to merge 1 commit into
openimsdk:mainfrom
redflyingfish:fix-3496-conversation-sync-main-clean
Open

feat: optimize fresh device conversation sync#3740
redflyingfish wants to merge 1 commit into
openimsdk:mainfrom
redflyingfish:fix-3496-conversation-sync-main-clean

Conversation

@redflyingfish

Copy link
Copy Markdown

🅰 Please add the issue ID after "Fixes #"

Fixes #3496
Depends on openimsdk/protocol#203.

Summary

This PR optimizes fresh device conversation sync for users with a large number of conversations.

When a fresh device logs in with idHash = 0, the server currently returns all owner conversation IDs. For users with many historical conversations, this can produce a very large sync response and trigger expensive follow-up sync work.

This change:

  • adds optional pagination support to GetFullOwnerConversationIDs;
  • returns the total number of filtered conversation IDs;
  • filters read and inactive conversations only when the conversation count is above the threshold;
  • keeps pinned conversations in the full sync result;
  • adds a dedicated full-sync seq RPC path so ordinary seq queries do not fetch userMinSeq;
  • adds tests for pagination, hash matching, pinned conversations, inactive filtering, cleared conversations, and small conversation sets.

Protocol dependency

This PR requires the protocol additions from openimsdk/protocol#203:

  • GetFullOwnerConversationIDsReq.pagination
  • GetFullOwnerConversationIDsResp.total
  • GetConversationsFullSyncSeqs
  • FullSyncSeqs.userMinSeq

Until openimsdk/protocol#203 is merged and released, CI builds that use the current official protocol version may fail with missing GetConversationsFullSyncSeqs types/methods.

After the protocol PR is merged and released, this PR should bump github.com/openimsdk/protocol to the corresponding version.

Testing

Tested locally with github.com/openimsdk/protocol replaced by the protocol branch from openimsdk/protocol#203:

go test -mod=mod ./internal/rpc/conversation ./internal/rpc/msg ./pkg/rpcli ./pkg/common/storage/controller ./pkg/common/storage/model

@pull-request-size pull-request-size Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

💕 Thank you for your contribution and please kindly read and sign our CLA. CLA Docs


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@redflyingfish

Copy link
Copy Markdown
Author

Hi maintainers, the CLA Assistant link currently returns 404 for me, so I cannot complete the CLA signature from the provided link. Could you please check the CLA configuration or provide the correct signing URL?

Also, the current CI failure is expected because this server PR depends on openimsdk/protocol#203, and the official protocol version used by main does not include the new GetConversationsFullSyncSeqs generated types yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]Avoid syncing all historical conversations on new device login

1 participant