This is an automated email from the ASF dual-hosted git repository.
sureshanaparti pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push:
new 097359bef9e plugins/shutdown: fix triggerShutdown scheduling and
response (#9276)
097359bef9e is described below
commit 097359bef9ed2f7448083deda734806326e88d4f
Author: Abhishek Kumar <[email protected]>
AuthorDate: Fri Jun 21 10:12:16 2024 +0530
plugins/shutdown: fix triggerShutdown scheduling and response (#9276)
Earlier the triggerShutdown API would immediately shutdown the MS and if
it is the same MS on which API is called it would lead to error in the
API call. This change adds a delay to the process so the MS would be
able to send response to the API.
Signed-off-by: Abhishek Kumar <[email protected]>
---
.../java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
a/plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java
b/plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java
index b8f5fb57155..da3bba54bdc 100644
---
a/plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java
+++
b/plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java
@@ -107,7 +107,10 @@ public class ShutdownManagerImpl extends ManagerBase
implements ShutdownManager,
this.shutdownTask = null;
}
this.shutdownTask = new ShutdownTask(this);
- timer.scheduleAtFixedRate(shutdownTask, 0, 30L * 1000);
+ long period = 30L * 1000;
+ long delay = period / 2;
+ logger.debug(String.format("Scheduling shutdown task with delay: %d
and period: %d", delay, period));
+ timer.scheduleAtFixedRate(shutdownTask, delay, period);
}
@Override