mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-20 07:46:05 -04:00
Removed STRESS_TEST flag
This commit is contained in:
parent
ff2c9d619f
commit
8dd9069ecb
@ -3,8 +3,6 @@ package io.bitsquare.common;
|
||||
import java.time.Duration;
|
||||
|
||||
public interface Timer {
|
||||
boolean STRESS_TEST = false;
|
||||
|
||||
Timer runLater(java.time.Duration delay, Runnable action);
|
||||
|
||||
Timer runPeriodically(Duration interval, Runnable runnable);
|
||||
|
@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
// TODO use https://github.com/timmolter/XChange
|
||||
@ -45,9 +46,9 @@ public class PriceFeed {
|
||||
}
|
||||
}
|
||||
|
||||
private static final long PERIOD_FIAT_SEC = 90;
|
||||
private static final long PERIOD_ALL_FIAT_SEC = 60 * 3;
|
||||
private static final long PERIOD_ALL_CRYPTO_SEC = 60 * 3;
|
||||
private static final long PERIOD_FIAT_SEC = new Random().nextInt(5) + 90;
|
||||
private static final long PERIOD_ALL_FIAT_SEC = new Random().nextInt(5) + 180;
|
||||
private static final long PERIOD_ALL_CRYPTO_SEC = new Random().nextInt(5) + 180;
|
||||
|
||||
private final Map<String, MarketPrice> cache = new HashMap<>();
|
||||
private final PriceProvider fiatPriceProvider = new BitcoinAveragePriceProvider();
|
||||
|
@ -65,10 +65,10 @@ import static io.bitsquare.util.Validator.nonEmptyStringOf;
|
||||
public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMessageListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(OpenOfferManager.class);
|
||||
|
||||
private static final long RETRY_REPUBLISH_DELAY_SEC = Timer.STRESS_TEST ? 1 : 10;
|
||||
private static final long REPUBLISH_AGAIN_AT_STARTUP_DELAY_SEC = Timer.STRESS_TEST ? 1 : 10;
|
||||
private static final long REPUBLISH_INTERVAL_MS = Timer.STRESS_TEST ? 3000 : TimeUnit.MINUTES.toMillis(15);
|
||||
private static final long REFRESH_INTERVAL_MS = Timer.STRESS_TEST ? 1000 : TimeUnit.MINUTES.toMillis(4);
|
||||
private static final long RETRY_REPUBLISH_DELAY_SEC = 10;
|
||||
private static final long REPUBLISH_AGAIN_AT_STARTUP_DELAY_SEC = 10;
|
||||
private static final long REPUBLISH_INTERVAL_MS = TimeUnit.MINUTES.toMillis(15);
|
||||
private static final long REFRESH_INTERVAL_MS = TimeUnit.MINUTES.toMillis(4);
|
||||
|
||||
private final KeyRing keyRing;
|
||||
private final User user;
|
||||
|
@ -27,8 +27,7 @@ public class BroadcastHandler implements PeerManager.Listener {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BroadcastHandler.class);
|
||||
private static final long TIMEOUT_PER_PEER_SEC = Timer.STRESS_TEST ? 5 : 30;
|
||||
private static final long DELAY_MS = Timer.STRESS_TEST ? 100 : 500;
|
||||
private static final long TIMEOUT_PER_PEER_SEC = 30;
|
||||
|
||||
interface ResultHandler {
|
||||
void onCompleted(BroadcastHandler broadcastHandler);
|
||||
|
@ -24,9 +24,9 @@ public class PeerManager implements ConnectionListener {
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
private static final Logger log = LoggerFactory.getLogger(PeerManager.class);
|
||||
|
||||
private static final long CHECK_MAX_CONN_DELAY_SEC = Timer.STRESS_TEST ? 1 : 5;
|
||||
private static final long CHECK_MAX_CONN_DELAY_SEC = 5;
|
||||
// Use a long delay as the bootstrapping peer might need a while until it knows its onion address
|
||||
private static final long REMOVE_ANONYMOUS_PEER_SEC = Timer.STRESS_TEST ? 10 : 120;
|
||||
private static final long REMOVE_ANONYMOUS_PEER_SEC = 120;
|
||||
|
||||
private static final int MAX_REPORTED_PEERS = 1000;
|
||||
private static final int MAX_PERSISTED_PEERS = 500;
|
||||
|
@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class GetDataRequestHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(GetDataRequestHandler.class);
|
||||
|
||||
private static final long TIME_OUT_SEC = Timer.STRESS_TEST ? 5 : 20;
|
||||
private static final long TIME_OUT_SEC = 20;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -30,7 +30,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
public class RequestDataHandler implements MessageListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(RequestDataHandler.class);
|
||||
|
||||
private static final long TIME_OUT_SEC = Timer.STRESS_TEST ? 5 : 20;
|
||||
private static final long TIME_OUT_SEC = 20;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -22,7 +22,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
public class RequestDataManager implements MessageListener, ConnectionListener, PeerManager.Listener {
|
||||
private static final Logger log = LoggerFactory.getLogger(RequestDataManager.class);
|
||||
|
||||
private static final long RETRY_DELAY_SEC = Timer.STRESS_TEST ? 3 : 10;
|
||||
private static final long RETRY_DELAY_SEC = 10;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
|
||||
class KeepAliveHandler implements MessageListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(KeepAliveHandler.class);
|
||||
|
||||
private static int DELAY_MS = Timer.STRESS_TEST ? 1000 : 10_000;
|
||||
private static int DELAY_MS = 10_000;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -22,7 +22,7 @@ import java.util.Random;
|
||||
public class KeepAliveManager implements MessageListener, ConnectionListener, PeerManager.Listener {
|
||||
private static final Logger log = LoggerFactory.getLogger(KeepAliveManager.class);
|
||||
|
||||
private static final int INTERVAL_SEC = Timer.STRESS_TEST ? 2 : new Random().nextInt(5) + 20;
|
||||
private static final int INTERVAL_SEC = new Random().nextInt(5) + 20;
|
||||
private static final long LAST_ACTIVITY_AGE_MS = INTERVAL_SEC / 2;
|
||||
|
||||
private final NetworkNode networkNode;
|
||||
|
@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||
class GetPeersRequestHandler {
|
||||
private static final Logger log = LoggerFactory.getLogger(GetPeersRequestHandler.class);
|
||||
|
||||
private static final long TIME_OUT_SEC = Timer.STRESS_TEST ? 5 : 20;
|
||||
private static final long TIME_OUT_SEC = 20;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit;
|
||||
class PeerExchangeHandler implements MessageListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(PeerExchangeHandler.class);
|
||||
|
||||
private static final long TIME_OUT_SEC = Timer.STRESS_TEST ? 5 : 20;
|
||||
private static int DELAY_MS = Timer.STRESS_TEST ? 1000 : 1000;
|
||||
private static final long TIME_OUT_SEC = 20;
|
||||
private static int DELAY_MS = 1000;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -21,9 +21,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class PeerExchangeManager implements MessageListener, ConnectionListener, PeerManager.Listener {
|
||||
private static final Logger log = LoggerFactory.getLogger(PeerExchangeManager.class);
|
||||
|
||||
private static final long RETRY_DELAY_SEC = Timer.STRESS_TEST ? 2 : 10;
|
||||
private static final long RETRY_DELAY_AFTER_ALL_CON_LOST_SEC = Timer.STRESS_TEST ? 1 : 3;
|
||||
private static final long REQUEST_PERIODICALLY_INTERVAL_SEC = Timer.STRESS_TEST ? 5 : 10 * 60;
|
||||
private static final long RETRY_DELAY_SEC = 10;
|
||||
private static final long RETRY_DELAY_AFTER_ALL_CON_LOST_SEC = 3;
|
||||
private static final long REQUEST_PERIODICALLY_INTERVAL_SEC = 10 * 60;
|
||||
|
||||
private final NetworkNode networkNode;
|
||||
private final PeerManager peerManager;
|
||||
|
@ -47,7 +47,7 @@ public class P2PDataStorage implements MessageListener, ConnectionListener {
|
||||
public static final int PURGE_AGE_DAYS = 10;
|
||||
|
||||
@VisibleForTesting
|
||||
public static int CHECK_TTL_INTERVAL_SEC = Timer.STRESS_TEST ? 5 : 60;
|
||||
public static int CHECK_TTL_INTERVAL_SEC = 60;
|
||||
|
||||
private final Broadcaster broadcaster;
|
||||
private final Map<ByteArray, ProtectedStorageEntry> map = new ConcurrentHashMap<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user