agent: reconnect after waiting 5 seconds (#9258)

* agent: reconnect after waiting 5 seconds

* Update agent/src/main/java/com/cloud/agent/Agent.java

* Update agent/src/main/java/com/cloud/agent/Agent.java

Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
This commit is contained in:
Wei Zhou 2024-06-26 11:03:26 +02:00 committed by GitHub
parent f7f7013ed0
commit 52247c57bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1141,6 +1141,12 @@ public class Agent implements HandlerFactory, IAgentControl, AgentStatusUpdater
s_logger.error("Error parsing task", e);
}
} else if (task.getType() == Task.Type.DISCONNECT) {
try {
// an issue has been found if reconnect immediately after disconnecting. please refer to https://github.com/apache/cloudstack/issues/8517
// wait 5 seconds before reconnecting
Thread.sleep(5000);
} catch (InterruptedException e) {
}
reconnect(task.getLink());
return;
} else if (task.getType() == Task.Type.OTHER) {