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