ruanwenjun commented on code in PR #13948:
URL:
https://github.com/apache/dolphinscheduler/pull/13948#discussion_r1176660959
##########
dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/future/ResponseFuture.java:
##########
@@ -180,24 +180,22 @@ public void release() {
* scan future table
*/
public static void scanFutureTable() {
- final List<ResponseFuture> futureList = new LinkedList<>();
Iterator<Map.Entry<Long, ResponseFuture>> it =
FUTURE_TABLE.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Long, ResponseFuture> next = it.next();
ResponseFuture future = next.getValue();
- if ((future.getBeginTimestamp() + future.getTimeoutMillis() +
1000) <= System.currentTimeMillis()) {
- futureList.add(future);
- it.remove();
- log.warn("remove timeout request : {}", future);
+ if ((future.getBeginTimestamp() + future.getTimeoutMillis() +
1000) > System.currentTimeMillis()) {
+ continue;
}
- }
- for (ResponseFuture future : futureList) {
try {
+ // todo: use thread pool to execute the async callback,
otherwise will block the scan thread
future.release();
future.executeInvokeCallback();
} catch (Exception ex) {
- log.warn("scanFutureTable, execute callback error", ex);
+ log.error("ScanFutureTable, execute callback error, requestId:
{}", future.getOpaque(), ex);
}
+ it.remove();
+ log.warn("Remove timeout request: {}", future);
Review Comment:
Done
--
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]