Fix TaskResource to convert TaskInfo response to thrift
@@ -201,15 +201,7 @@ public class TaskResource
Duration waitTime = randomizeWaitTime(maxWait);
ListenableFuture<TaskInfo> futureTaskInfo = addTimeout(
taskManager.getTaskInfo(taskId, currentState),
- () -> {
- TaskInfo taskInfo = taskManager.getTaskInfo(taskId);
- if (isThriftRequest) {
- return convertToThriftTaskInfo(taskInfo, connectorTypeSerdeManager, handleResolver);
- }
- else {
- return taskInfo;
- }
- },
+ () -> taskManager.getTaskInfo(taskId),
waitTime,
timeoutExecutor);
@@ -217,6 +209,13 @@ public class TaskResource
futureTaskInfo = Futures.transform(futureTaskInfo, TaskInfo::summarize, directExecutor());
}
+ if (isThriftRequest) {
+ futureTaskInfo = Futures.transform(
+ futureTaskInfo,
+ taskInfo -> convertToThriftTaskInfo(taskInfo, connectorTypeSerdeManager, handleResolver),
+ directExecutor());
+ }
+
// For hard timeout, add an additional time to max wait for thread scheduling contention and GC
Duration timeout = new Duration(waitTime.toMillis() + ADDITIONAL_WAIT_TIME.toMillis(), MILLISECONDS);
bindAsyncResponse(asyncResponse, futureTaskInfo, responseExecutor)
