[agent][executor]- bug -1

This commit is contained in:
zeaslity
2023-02-25 18:21:10 +08:00
parent 0d8c89e4ec
commit bdf13f5f41

View File

@@ -107,12 +107,6 @@ public class CommandExecutor {
// 开始执行命令操作 // 开始执行命令操作
Process process = processBuilder.start(); Process process = processBuilder.start();
// 缓存 命令处理日志
commandExecLogCache.cacheLog(
streamKey,
process
);
// 守护进程 对每一条任务的超时时间进行限制,避免卡死 // 守护进程 对每一条任务的超时时间进行限制,避免卡死
int commandExecWaitTimeout = processMaxWaitSeconds; int commandExecWaitTimeout = processMaxWaitSeconds;
if (durationTask) { if (durationTask) {
@@ -172,7 +166,11 @@ public class CommandExecutor {
try { try {
log.debug( log.debug(
"命令执行守护进程开始等待 {} s for the result", "[ {} ]命令执行守护进程开始等待 {} s for the result",
process
.info()
.commandLine()
.get(),
commandExecWaitTimeout commandExecWaitTimeout
); );
@@ -186,6 +184,12 @@ public class CommandExecutor {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
// 缓存 命令处理日志
commandExecLogCache.cacheLog(
streamKey,
process
);
// 任务提前执行结束,或者超过了最长等待时间 // 任务提前执行结束,或者超过了最长等待时间
// 判断命令是否正确处理完成 // 判断命令是否正确处理完成
if (!commandExecComplete) { if (!commandExecComplete) {
@@ -200,11 +204,11 @@ public class CommandExecutor {
} }
// 日志操作,如果需要显示回传,需要将日志发送回相应的 // 日志操作,如果需要显示回传,需要将日志发送回相应的
/*collectCommandLogAndRepeat( collectCommandLogAndRepeat(
streamKey, streamKey,
needResultReplay, needResultReplay,
octopusMessage octopusMessage
);*/ );
// 只有当该进程还存活,执行关闭操作 // 只有当该进程还存活,执行关闭操作
if (process.isAlive()) { if (process.isAlive()) {