REQ-3345: 同步消息

This commit is contained in:
yanglin 2025-01-23 17:07:57 +08:00
parent 4d92ce92a3
commit dc9fff1876
2 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class GroupMessageSyncer implements Runnable {
Timeline timeline = new Timeline(beginMs, endMs);
// don't change
long limit = 100L;
TimeNode node = timeline.peek();
TimeNode node = timeline.head();
while (node != null) {
NimGroupGetMessagesResponse response = fetchMessages(node, limit);
BizAssertions.assertTrue(response.isSuccess(), "fetch group messages failed");

View File

@ -28,26 +28,26 @@ public class Timeline {
}
public TimeNode split() {
TimeNode node = peek();
TimeNode node = head();
BizAssertions.assertNotNull(node, "timeline is empty");
//noinspection DataFlowIssue
BizAssertions.assertTrue(node.isSplittable(), "node is not splittable: ", node);
nodes.removeFirst();
splitCount *= 2;
prepend(split(node.getBeginMs(), node.getEndMs()));
return peek();
return head();
}
public TimeNode consume() {
TimeNode node = peek();
TimeNode node = head();
BizAssertions.assertNotNull(node, "timeline is empty");
nodes.removeFirst();
splitCount = 1;
return peek();
return head();
}
@Nullable
public TimeNode peek() {
public TimeNode head() {
return nodes.peek();
}