Skip to content

Commit 097359b

Browse files
authored
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 <abhishek.mrt22@gmail.com>
1 parent ae3fa5d commit 097359b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

plugins/shutdown/src/main/java/org/apache/cloudstack/shutdown/ShutdownManagerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ private void prepareForShutdown(boolean postTrigger) {
107107
this.shutdownTask = null;
108108
}
109109
this.shutdownTask = new ShutdownTask(this);
110-
timer.scheduleAtFixedRate(shutdownTask, 0, 30L * 1000);
110+
long period = 30L * 1000;
111+
long delay = period / 2;
112+
logger.debug(String.format("Scheduling shutdown task with delay: %d and period: %d", delay, period));
113+
timer.scheduleAtFixedRate(shutdownTask, delay, period);
111114
}
112115

113116
@Override

0 commit comments

Comments
 (0)