mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
fix cycling through price providers
This commit is contained in:
parent
6cb120e4b9
commit
c7277187c5
1 changed files with 8 additions and 3 deletions
|
@ -47,7 +47,7 @@ public class ProvidersRepository {
|
|||
@Getter
|
||||
@Nullable
|
||||
private List<String> bannedNodes;
|
||||
private int index = 0;
|
||||
private int index = -1;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -80,16 +80,21 @@ public class ProvidersRepository {
|
|||
}
|
||||
|
||||
// returns true if provider selection loops to beginning
|
||||
public boolean selectNextProviderBaseUrl() {
|
||||
public synchronized boolean selectNextProviderBaseUrl() {
|
||||
boolean looped = false;
|
||||
if (!providerList.isEmpty()) {
|
||||
|
||||
// increment index
|
||||
index++;
|
||||
|
||||
// loop to beginning
|
||||
if (index >= providerList.size()) {
|
||||
index = 0;
|
||||
looped = true;
|
||||
}
|
||||
|
||||
// update base url
|
||||
baseUrl = providerList.get(index);
|
||||
index++;
|
||||
|
||||
if (providerList.size() == 1 && config.baseCurrencyNetwork.isMainnet())
|
||||
log.warn("We only have one provider");
|
||||
|
|
Loading…
Reference in a new issue