Skip to content

Commit 38d6a17

Browse files
committed
Merge pull request !88 from 胡贵/develop
2 parents a3c808f + d90fb09 commit 38d6a17

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lts-core/src/main/java/com/lts/core/monitor/MStatReportWorker.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ private void report(MData mData) {
9696
// Send monitor data
9797
mDataQueue.add(mData);
9898

99+
// check size
100+
int size = mDataQueue.size();
101+
if (size > MAX_RETRY_RETAIN) {
102+
// delete the oldest
103+
mDataQueue = mDataQueue.subList(size - MAX_RETRY_RETAIN, size);
104+
}
105+
99106
List<Node> monitorNodes = appContext.getSubscribedNodeManager().getNodeList(NodeType.MONITOR);
100107
if (CollectionUtils.isEmpty(monitorNodes)) {
101108
if (LOGGER.isDebugEnabled()) {
@@ -105,7 +112,7 @@ private void report(MData mData) {
105112
}
106113

107114
int toIndex = 0;
108-
int size = mDataQueue.size();
115+
size = mDataQueue.size();
109116
try {
110117
for (int i = 0; i <= size / BATCH_REPORT_SIZE; i++) {
111118
List<MData> mDatas = BatchUtils.getBatchList(i, BATCH_REPORT_SIZE, mDataQueue);
@@ -137,12 +144,6 @@ private void report(MData mData) {
137144
mDataQueue = mDataQueue.subList(toIndex + 1, size);
138145
}
139146
}
140-
// check size
141-
size = mDataQueue.size();
142-
if (size > MAX_RETRY_RETAIN) {
143-
// delete the oldest
144-
mDataQueue = mDataQueue.subList(size - MAX_RETRY_RETAIN, size);
145-
}
146147
}
147148

148149
// 发送请求

0 commit comments

Comments
 (0)