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>
This commit is contained in:
Abhishek Kumar 2024-06-21 10:12:16 +05:30 committed by GitHub
parent ae3fa5d0de
commit 097359bef9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,10 @@ public class ShutdownManagerImpl extends ManagerBase implements ShutdownManager,
this.shutdownTask = null; this.shutdownTask = null;
} }
this.shutdownTask = new ShutdownTask(this); 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 @Override