未验证 提交 f8d8e658 编写于 作者: Z zhangcly 提交者: GitHub

[ISSUE #4274] skip master-select task when db.num is 1 (#4790)

上级 f5a5fce4
......@@ -54,6 +54,8 @@ public class ExternalDataSourceServiceImpl implements DataSourceService {
private static final int TRANSACTION_QUERY_TIMEOUT = 5;
private static final int DB_MASTER_SELECT_THRESHOLD = 1;
private static final String DB_LOAD_ERROR_MSG = "[db-load-error]load jdbc.properties error";
private List<HikariDataSource> dataSourceList = new ArrayList<>();
......@@ -106,8 +108,10 @@ public class ExternalDataSourceServiceImpl implements DataSourceService {
e.printStackTrace();
throw new RuntimeException(DB_LOAD_ERROR_MSG);
}
ConfigExecutor.scheduleConfigTask(new SelectMasterTask(), 10, 10, TimeUnit.SECONDS);
if (this.dataSourceList.size() > DB_MASTER_SELECT_THRESHOLD) {
ConfigExecutor.scheduleConfigTask(new SelectMasterTask(), 10, 10, TimeUnit.SECONDS);
}
ConfigExecutor.scheduleConfigTask(new CheckDbHealthTask(), 10, 10, TimeUnit.SECONDS);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册