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

View File

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