Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
IceDerce
2023-01-04 14:31:19 +08:00
10 changed files with 303 additions and 127 deletions

View File

@@ -6,6 +6,7 @@ import io.wdd.agent.executor.thread.LogToArrayListCache;
import io.wdd.common.beans.executor.ExecutionMessage;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
@@ -86,12 +87,18 @@ public class CommandExecutor {
// start to send the result log
streamSender.startToWaitLog(streamKey);
// get the command result
processResult = process.waitFor();
// todo this will stuck the process and rabbitmq message will reentry the queue
// get the command result must also be a timeout smaller than the process
boolean waitFor = process.waitFor(50, TimeUnit.SECONDS);
// end send logs
streamSender.endWaitLog(streamKey);
// get the process result
if (ObjectUtils.isNotEmpty(waitFor) && ObjectUtils.isNotEmpty(process)) {
processResult = process.exitValue();
}
log.debug("current shell command {} result is {}", processBuilder.command(), processResult);
@@ -106,7 +113,6 @@ public class CommandExecutor {
return () -> {
try {
log.debug("daemon thread start to wait for {} s for the result", processMaxWaitSeconds);
TimeUnit.SECONDS.sleep(processMaxWaitSeconds);

View File

@@ -31,7 +31,7 @@ public class CollectAllExecutorFunction {
/**
* store the Octopus Agent Functions and Reflection Class Path
* store the Octopus Agent Functions and Function Command List
* key: function name
* value: function shell List<String> contend
*/