添加分段同步好友/好友请求/用户设置的功能
This commit is contained in:
@@ -135,6 +135,10 @@ group.visible_quit_or_kickoff_notification 0
|
||||
## 注意,修改本配置不会对已经同步的信息产生影响。
|
||||
#user.hide_properties 3,4,5
|
||||
|
||||
# 好友/好友请求/用户设置 这三类数据同步的最大条目数。之前是客户第一次登录时,会把所有的对应数据一次下载到客户端,但如果有特别多的信息,会导致无法同步到客户端,
|
||||
# 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。
|
||||
#sync.data_part_size 1000
|
||||
|
||||
#*********************************************************************
|
||||
# hazelcase configuration
|
||||
#*********************************************************************
|
||||
|
||||
@@ -157,6 +157,7 @@ public final class BrokerConstants {
|
||||
public static final String GROUP_Visible_Quit_Kickoff_Notification = "group.visible_quit_or_kickoff_notification";
|
||||
|
||||
public static final String USER_HIDE_PROPERTIES = "user.hide_properties";
|
||||
public static final String SYNC_Data_Part_Size = "sync.data_part_size";
|
||||
|
||||
public static final String MESSAGES_FORBIDDEN_CLIENT_SEND_TYPES = "message.forbidden_client_send_types";
|
||||
public static final String MESSAGES_BLACKLIST_EXCEPTION_TYPES = "message.blacklist_exception_types";
|
||||
|
||||
@@ -154,6 +154,7 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
private String mChatroomMemberUpdateCallback;
|
||||
private boolean mGroupAllowClientCustomOperationNotification;
|
||||
private int mGroupVisibleQuitKickoffNotification;
|
||||
private int mSyncDataPartSize = 0;
|
||||
|
||||
private Set<Integer> mUserHideProperties = new HashSet<>();
|
||||
|
||||
@@ -381,6 +382,12 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
mSyncDataPartSize = Integer.parseInt(server.getConfig().getProperty(SYNC_Data_Part_Size, "0"));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
String userHideStr = server.getConfig().getProperty(USER_HIDE_PROPERTIES);
|
||||
@@ -2573,6 +2580,11 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
}
|
||||
}
|
||||
|
||||
if(mSyncDataPartSize > 0 && out.size() > mSyncDataPartSize) {
|
||||
out.sort(Comparator.comparingLong(FriendData::getTimestamp));
|
||||
out = out.subList(0, mSyncDataPartSize);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -2618,6 +2630,10 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
}
|
||||
}
|
||||
|
||||
if(mSyncDataPartSize > 0 && out.size() > mSyncDataPartSize) {
|
||||
out.sort(Comparator.comparingLong(WFCMessage.FriendRequest::getUpdateDt));
|
||||
out = out.subList(0, mSyncDataPartSize);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -3111,6 +3127,12 @@ public class MemoryMessagesStore implements IMessagesStore {
|
||||
}
|
||||
}
|
||||
|
||||
if(mSyncDataPartSize > 0 && ec == ErrorCode.ERROR_CODE_SUCCESS && builder.getEntryCount() > mSyncDataPartSize) {
|
||||
List<WFCMessage.UserSettingEntry> list = new ArrayList<>(builder.getEntryList());
|
||||
list.sort(Comparator.comparingLong(WFCMessage.UserSettingEntry::getUpdateDt));
|
||||
list = list.subList(0, mSyncDataPartSize);
|
||||
builder.clearEntry().addAllEntry(list);
|
||||
}
|
||||
return ec;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,10 @@ group.visible_quit_or_kickoff_notification 0
|
||||
## 注意,修改本配置不会对已经同步的信息产生影响。
|
||||
#user.hide_properties 3,4
|
||||
|
||||
# 好友/好友请求/用户设置 这三类数据同步的最大条目数。之前是客户第一次登录时,会把所有的对应数据一次下载到客户端,但如果有特别多的信息,会导致无法同步到客户端,
|
||||
# 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。
|
||||
#sync.data_part_size 1000
|
||||
|
||||
#*********************************************************************
|
||||
# hazelcase configuration
|
||||
#*********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user