任务触发组件优化,常规1s预加载一次,预加载轮空时主动休眠4s,降低加载频率以及对DB压力;

This commit is contained in:
xuxueli 2019-07-18 21:57:30 +08:00
parent c00a2995c8
commit ac86231d2e
1 changed files with 2 additions and 2 deletions

View File

@ -194,8 +194,8 @@ public class JobScheduleHelper {
// Wait seconds, align second // Wait seconds, align second
if (cost < 1000) { // scan-overtime, not wait if (cost < 1000) { // scan-overtime, not wait
try { try {
// pre-read success, exist job in 5s, wait 1s; // pre-read success, exist job in pre-read period, wait 1s;
// pre-read fail, no exist job in 5s, wait 1s // pre-read fail, no exist job in pre-read period, wait 4s
TimeUnit.MILLISECONDS.sleep((preReadSuc?1000:4000) - System.currentTimeMillis()%1000); TimeUnit.MILLISECONDS.sleep((preReadSuc?1000:4000) - System.currentTimeMillis()%1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (!scheduleThreadToStop) { if (!scheduleThreadToStop) {