dugenkui03 commented on code in PR #4169:
URL: https://github.com/apache/rocketmq/pull/4169#discussion_r850701643


##########
client/src/main/java/org/apache/rocketmq/client/trace/AsyncTraceDispatcher.java:
##########
@@ -243,113 +245,130 @@ class AsyncRunnable implements Runnable {
         @Override
         public void run() {
             while (!stopped) {
-                List<TraceContext> contexts = new 
ArrayList<TraceContext>(batchSize);
                 synchronized (traceContextQueue) {
-                    for (int i = 0; i < batchSize; i++) {
-                        TraceContext context = null;
+                    long endTime = System.currentTimeMillis() + 
waitTimeThreshold;
+                    while (System.currentTimeMillis() < endTime) {

Review Comment:
   Set `waitTimeThreshold` to could ensure that all data could send out in 
1000ms.
   
   > 
将`waitTimeThreshold`设置为500ms可以保证数据在本地保存时间不超过1000ms,因为有些很早放入的数据可能持续到下一次检查才会’过时‘。如果想尽可能及时的发送超时waitTimeThreshold的数据可修改endTime获取逻辑、如下。
   ```
   long endTime = System.currentTimeMillis() + waitTimeThreshold / 2;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to