mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-03 12:16:27 -04:00
Constant for mailbox message delay in network stress test
This commit is contained in:
parent
d1c6d4ad9c
commit
2a24ce94a3
1 changed files with 5 additions and 5 deletions
|
@ -71,6 +71,8 @@ public class NetworkStressTest {
|
||||||
private static long MIN_DIRECT_DELAY_MILLIS = Math.round(1.25 * (1.0 / Connection.MSG_THROTTLE_PER_SEC) * 1000);
|
private static long MIN_DIRECT_DELAY_MILLIS = Math.round(1.25 * (1.0 / Connection.MSG_THROTTLE_PER_SEC) * 1000);
|
||||||
/** Maximum delay between direct messages in milliseconds, 10 times larger than minimum. */
|
/** Maximum delay between direct messages in milliseconds, 10 times larger than minimum. */
|
||||||
private static long MAX_DIRECT_DELAY_MILLIS = 10 * MIN_DIRECT_DELAY_MILLIS;
|
private static long MAX_DIRECT_DELAY_MILLIS = 10 * MIN_DIRECT_DELAY_MILLIS;
|
||||||
|
/** Estimated delay in seconds to send or receive a mailbox message. */
|
||||||
|
private static long MAILBOX_DELAY_SECS = 2;
|
||||||
|
|
||||||
// Instance fields
|
// Instance fields
|
||||||
|
|
||||||
|
@ -613,9 +615,8 @@ public class NetworkStressTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// TODO: Use meaningful timeout.
|
|
||||||
assertLatch("timed out while sending from peer " + firstOnline,
|
assertLatch("timed out while sending from peer " + firstOnline,
|
||||||
sendLatch, 2 * mailboxCount, TimeUnit.SECONDS);
|
sendLatch, MAILBOX_DELAY_SECS * mailboxCount, TimeUnit.SECONDS);
|
||||||
|
|
||||||
// When done, put first online peer offline.
|
// When done, put first online peer offline.
|
||||||
final CountDownLatch stopLatch = new CountDownLatch(1);
|
final CountDownLatch stopLatch = new CountDownLatch(1);
|
||||||
|
@ -631,12 +632,11 @@ public class NetworkStressTest {
|
||||||
peerNodes.set(firstOffline, startedPeer);
|
peerNodes.set(firstOffline, startedPeer);
|
||||||
startedPeer.start(new MailboxStartListener(startLatch));
|
startedPeer.start(new MailboxStartListener(startLatch));
|
||||||
assertLatch("timed out while starting peer " + firstOffline,
|
assertLatch("timed out while starting peer " + firstOffline,
|
||||||
startLatch, 10, TimeUnit.SECONDS);
|
startLatch, 10 + MAILBOX_DELAY_SECS * nPeers, TimeUnit.SECONDS);
|
||||||
//print("put peer %d online", firstOffline);
|
//print("put peer %d online", firstOffline);
|
||||||
}
|
}
|
||||||
// TODO: Use meaningful timeout.
|
|
||||||
assertLatch("timed out while receiving mailbox messages",
|
assertLatch("timed out while receiving mailbox messages",
|
||||||
receivedMailboxLatch, 120, TimeUnit.SECONDS);
|
receivedMailboxLatch, 2 * (MAILBOX_DELAY_SECS + 1) * nPeers * mailboxCount, TimeUnit.SECONDS);
|
||||||
org.junit.Assert.assertFalse("some peer(s) failed to send a message", sentMailboxFailed.get());
|
org.junit.Assert.assertFalse("some peer(s) failed to send a message", sentMailboxFailed.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue