start polling for best connection after delay

This commit is contained in:
woodser 2023-09-08 13:04:30 -04:00
parent da9b251f12
commit 77cf67e6f0

View file

@ -1,5 +1,6 @@
package haveno.core.api;
import haveno.common.UserThread;
import haveno.common.app.DevEnv;
import haveno.common.config.Config;
import haveno.core.trade.HavenoUtils;
@ -469,6 +470,13 @@ public final class CoreMoneroConnectionsService {
// register connection listener
connectionManager.addListener(this::onConnectionChanged);
// start polling for best connection after delay
if ("".equals(config.xmrNode)) {
UserThread.runAfter(() -> {
if (!isShutDownStarted) connectionManager.startPolling(getRefreshPeriodMs() * 2);
}, getDefaultRefreshPeriodMs() * 2 / 1000);
}
// notify final connection
isInitialized = true;
onConnectionChanged(connectionManager.getConnection());