mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-12-12 04:43:32 +01:00
fix cycling through price providers
This commit is contained in:
parent
6cb120e4b9
commit
c7277187c5
@ -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 New Issue
Block a user