Wait a bit longer for ttl to have occurred
This commit is contained in:
parent
18141b8da0
commit
aa5c15a1d7
|
@ -23,7 +23,7 @@ import static org.hamcrest.Matchers.*;
|
||||||
public class TTLPercolatorTests extends AbstractNodesTests {
|
public class TTLPercolatorTests extends AbstractNodesTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThatPercolatingWithTimeToLiveWorks() throws Exception {
|
public void testPercolatingWithTimeToLive() throws Exception {
|
||||||
long purgeInterval = 200;
|
long purgeInterval = 200;
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("gateway.type", "none")
|
.put("gateway.type", "none")
|
||||||
|
@ -69,10 +69,12 @@ public class TTLPercolatorTests extends AbstractNodesTests {
|
||||||
).execute().actionGet();
|
).execute().actionGet();
|
||||||
assertThat(convertFromTextArray(percolateResponse.getMatches()), arrayContaining("kuku"));
|
assertThat(convertFromTextArray(percolateResponse.getMatches()), arrayContaining("kuku"));
|
||||||
|
|
||||||
long now1 = System.currentTimeMillis();
|
long timeSpent = System.currentTimeMillis() - now;
|
||||||
if ((now1 - now) <= (ttl + purgeInterval)) {
|
long waitTime = ttl + purgeInterval + 200;
|
||||||
logger.info("Waiting for ttl purger...");
|
if (timeSpent <= waitTime) {
|
||||||
Thread.sleep((ttl + purgeInterval) - (now1 - now));
|
long timeToWait = waitTime - timeSpent;
|
||||||
|
logger.info("Waiting {} ms for ttl purging...", timeToWait);
|
||||||
|
Thread.sleep(timeToWait);
|
||||||
}
|
}
|
||||||
percolateResponse = client.preparePercolate("test", "type1").setSource(jsonBuilder()
|
percolateResponse = client.preparePercolate("test", "type1").setSource(jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
|
|
Loading…
Reference in New Issue