[ agent ] [ agent ] - agent bootup optimize
This commit is contained in:
@@ -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,17 @@ public class CommandExecutor {
|
||||
// start to send the result log
|
||||
streamSender.startToWaitLog(streamKey);
|
||||
|
||||
// get the command result
|
||||
processResult = process.waitFor();
|
||||
// get the command result must also be a timeout smaller than the process
|
||||
boolean waitFor = process.waitFor(processMaxWaitSeconds, 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 +112,6 @@ public class CommandExecutor {
|
||||
return () -> {
|
||||
try {
|
||||
|
||||
|
||||
log.debug("daemon thread start to wait for {} s for the result", processMaxWaitSeconds);
|
||||
|
||||
TimeUnit.SECONDS.sleep(processMaxWaitSeconds);
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user