[agent][executor]- bug

This commit is contained in:
zeaslity
2023-02-25 18:17:36 +08:00
parent 8bdb40e347
commit 0d8c89e4ec

View File

@@ -57,7 +57,6 @@ public class CommandExecutor {
*/
public void execute(OctopusMessage octopusMessage, ExecutionMessage executionMessage) {
// todo 需要长时间执行的任务 与目前的系统设计存在冲突 防卡死后台进程`出现问题
// 防止阻塞消息队列中的其他信息,需要使用异步执行
AgentCommonThreadPool.pool.submit(
() -> this.execute(
@@ -140,13 +139,10 @@ public class CommandExecutor {
int waitFor = process.waitFor();
// get the process result
if (ObjectUtils.isNotEmpty(waitFor) && ObjectUtils.isNotEmpty(process)) {
if (ObjectUtils.isNotEmpty(waitFor) && ObjectUtils.isNotEmpty(process.info())) {
// 命令执行完成, countDownLatch计数
countDownLatch.countDown();
// 设置 命令执行退出返回值
processResult = process.exitValue();
}
log.debug(
@@ -155,6 +151,9 @@ public class CommandExecutor {
processResult
);
// 设置 命令执行退出返回值
processResult = process.exitValue();
} catch (IOException | InterruptedException e) {
log.error(
"Shell command error ! {} + {}",
@@ -201,11 +200,11 @@ public class CommandExecutor {
}
// 日志操作,如果需要显示回传,需要将日志发送回相应的
collectCommandLogAndRepeat(
/*collectCommandLogAndRepeat(
streamKey,
needResultReplay,
octopusMessage
);
);*/
// 只有当该进程还存活,执行关闭操作
if (process.isAlive()) {