RetryableTask: 避免最后一次任务执行时的线程睡眠

This commit is contained in:
Toint
2025-05-18 19:25:41 +08:00
parent e91dc5b756
commit b9cedd8798

View File

@@ -236,7 +236,10 @@ public class RetryableTask<T> {
break;
}
ThreadUtil.sleep(delay.toMillis());
// 避免最后一次任务执行时的线程睡眠
if (this.maxAttempts > 0) {
ThreadUtil.sleep(delay.toMillis());
}
}
this.throwable = th;