connectionService.getRefreshPeriodMs() is always positive, add docs

This commit is contained in:
woodser 2023-10-01 11:27:45 -04:00
parent 72c5632105
commit 057c629629
2 changed files with 3 additions and 7 deletions

View file

@ -251,11 +251,7 @@ public final class CoreMoneroConnectionsService {
} }
public long getRefreshPeriodMs() { public long getRefreshPeriodMs() {
if (connectionList.getRefreshPeriod() < 0 || connectionList.getRefreshPeriod() > 0) { return connectionList.getRefreshPeriod() > 0 ? connectionList.getRefreshPeriod() : getDefaultRefreshPeriodMs();
return connectionList.getRefreshPeriod();
} else {
return getDefaultRefreshPeriodMs();
}
} }
public void verifyConnection() { public void verifyConnection() {
@ -526,7 +522,7 @@ public final class CoreMoneroConnectionsService {
new Thread(() -> { new Thread(() -> {
synchronized (lock) { synchronized (lock) {
stopPolling(); stopPolling();
if (getRefreshPeriodMs() > 0) startPolling(); if (connectionList.getRefreshPeriod() >= 0) startPolling(); // 0 means default refresh poll
} }
}).start(); }).start();
} }

View file

@ -62,7 +62,7 @@ public class EncryptedConnectionList implements PersistableEnvelope, PersistedDa
private final Map<String, EncryptedConnection> items = new HashMap<>(); private final Map<String, EncryptedConnection> items = new HashMap<>();
private @NonNull String currentConnectionUrl = ""; private @NonNull String currentConnectionUrl = "";
private long refreshPeriod; private long refreshPeriod; // -1 means no refresh, 0 means default, >0 means custom
private boolean autoSwitch; private boolean autoSwitch;
@Inject @Inject