cshannon commented on code in PR #1628:
URL: https://github.com/apache/activemq/pull/1628#discussion_r2721492137
##########
activemq-unit-tests/src/test/java/org/apache/activemq/JMSConsumerTest.java:
##########
@@ -1019,15 +1016,22 @@ public void testAckOfExpired() throws Exception {
Session sendSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sendSession.createProducer(destination);
- producer.setTimeToLive(500);
+ final int ttl = 500;
+ producer.setTimeToLive(ttl);
final int count = 4;
for (int i = 0; i < count; i++) {
TextMessage message = sendSession.createTextMessage("" + i);
producer.send(message);
}
// let first bunch in queue expire
- Thread.sleep(1000);
+ final long expiryTime = System.currentTimeMillis() +
TimeUnit.MILLISECONDS.toMillis(ttl * 2L);
+ assertTrue("ttl elapsed", Wait.waitFor(new Wait.Condition() {
Review Comment:
I just noticed that something seemed off because the wait for was
essentially just looping until the sleep time finished and wasn't waiting for a
real condition to change (just time elapsing) so i am glad it is sorted
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact