Skip to content

Commit

Permalink
Reduce sleep interval duration for thread that listens for messages
Browse files Browse the repository at this point in the history
This seems to make the test pass more deterministically
If this value is higher than the one used for sending output (50ms) some messages may be lost
leading to failed test
  • Loading branch information
davidheryanto committed Mar 13, 2020
1 parent e7a1a39 commit 24d47cb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ public DummyStatsDServer(int port) {
server.receive(packet);
messagesReceived.add(
new String(packet.getData(), StandardCharsets.UTF_8).trim() + "\n");
Thread.sleep(50);
// The sleep duration here is shorter than that used in waitForMessage() at
// 50ms.
// Otherwise sometimes some messages seem to be lost, leading to flaky tests.
Thread.sleep(15L);
}

} catch (Exception e) {
Expand Down

0 comments on commit 24d47cb

Please # to comment.