fix: Cyclic Logging on Exception #769

This commit is contained in:
tjq 2024-02-08 10:42:47 +08:00
parent 1ba74bf0af
commit 4be6a139dd

View File

@ -67,8 +67,11 @@ public class CoreScheduleTaskManager implements InitializingBean, DisposableBean
log.info("start task : {}.", taskName);
while (true) {
try {
innerRunnable.run();
// 倒置顺序为 sleep 再执行解决异常情况 while true 打日志的问题 https://github.com/PowerJob/PowerJob/issues/769
Thread.sleep(runningInterval);
innerRunnable.run();
} catch (InterruptedException e) {
log.warn("[{}] task has been interrupted!", taskName, e);
break;