Skip to content

Commit

Permalink
Retrieve command timeout on fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
GutoVeronezi committed Feb 2, 2024
1 parent 1eb1672 commit 21aa879
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.CommandTimeoutDao;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.config.impl.CommandTimeoutVO;
import org.apache.cloudstack.framework.jobs.AsyncJob;
import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
Expand Down Expand Up @@ -159,6 +161,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
protected HostPodDao _podDao = null;
@Inject
protected ConfigurationDao _configDao = null;

@Inject
protected CommandTimeoutDao commandTimeoutDao;

@Inject
protected ClusterDao _clusterDao = null;

Expand Down Expand Up @@ -439,7 +445,18 @@ public Answer[] send(final Long hostId, final Commands commands, int timeout) th
}

if (timeout <= 0) {
timeout = Wait.value();

for (Command command : commands) {
CommandTimeoutVO commandTimeoutVo = commandTimeoutDao.findByCommandClasspath(command.getClass().getName());

if (commandTimeoutVo != null && commandTimeoutVo.getTimeout() > timeout) {
timeout = commandTimeoutVo.getTimeout();
}
}

if (timeout <= 0) {
timeout = Wait.value();
}
}

if (CheckTxnBeforeSending.value()) {
Expand Down

0 comments on commit 21aa879

Please sign in to comment.