refactor: 去除 TTY 提高性能

This commit is contained in:
fit2-zhao 2024-10-15 18:55:42 +08:00 committed by Craftsman
parent 9f36f05452
commit bafee17bc0
2 changed files with 9 additions and 10 deletions

View File

@ -26,8 +26,8 @@ public class KubernetesExecEngine implements ApiEngine {
/**
* 单调执行构造函数
*
* @param request
* @param resource
* @param request 任务请求参数
* @param resource 资源池
*/
public KubernetesExecEngine(TaskRequestDTO request, TestResourceDTO resource) {
this.request = request;
@ -37,8 +37,8 @@ public class KubernetesExecEngine implements ApiEngine {
/**
* 批量执行构造函数
*
* @param batchRequestDTO
* @param resource
* @param batchRequestDTO 批量任务请求参数
* @param resource 资源池
*/
public KubernetesExecEngine(TaskBatchRequestDTO batchRequestDTO, TestResourceDTO resource) {
this.resource = resource;
@ -48,8 +48,8 @@ public class KubernetesExecEngine implements ApiEngine {
/**
* 停止执行构造函数
*
* @param reportIds
* @param resource
* @param reportIds 任务ID列表
* @param resource 资源池
*/
public KubernetesExecEngine(List<String> reportIds, TestResourceDTO resource) {
this.resource = resource;

View File

@ -68,8 +68,8 @@ public class KubernetesProvider {
/**
* 执行命令
*
* @param resource
* @param command
* @param resource 资源
* @param command 命令
*/
protected static void exec(TestResourceDTO resource, Object runRequest, String command) {
KubernetesClient client = getKubernetesClient(resource);
@ -150,7 +150,6 @@ public class KubernetesProvider {
.redirectingInput()
.writingOutput(System.out)
.writingError(System.err)
.withTTY()
.usingListener(new SimpleListener(runRequest, client))
.exec(SHELL_COMMAND, "-c", command);
} catch (Exception e) {
@ -167,7 +166,7 @@ public class KubernetesProvider {
@Override
public void onFailure(Throwable t, Response response) {
LogUtils.error("K8s 监听失败", t);
if (runRequest != null && !(t instanceof SocketException)) {
if (runRequest != null) {
handleGeneralError(runRequest, t);
}
}