File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
lts-core/src/main/java/com/lts/core/monitor Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff 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 // 发送请求
You can’t perform that action at this time.
0 commit comments