Hi,
I'm using Vert.x 4.1.1, and I'm having issue with entry not being removed from cluster wide map after ttl expires. I wrote a reproducer unit test, that passes on Vert.x 3.5.4, but fails on 4.1.1. Do you have any idea why the entry is not removed from map after ttl expires?
Reproducer:
@Test
public void testEntryTtl(TestContext context) {
Async async = context.async();
Vertx.clusteredVertx(new VertxOptions(), clusteredVertxResult -> {
if (clusteredVertxResult.failed()) {
context.fail(clusteredVertxResult.cause());
}
Vertx vertx = clusteredVertxResult.result();
String mapName = "mapName";
String key = "key";
String value = "value";
long entryTtl = 200;
SharedData sharedData = vertx.sharedData();
sharedData.<String, String>getClusterWideMap(
mapName, (createMap) -> {
if (createMap.failed()) {
context.fail(createMap.cause());
}
AsyncMap<String, String> clusterSharedMap = createMap.result();
clusterSharedMap.put(key, value, entryTtl, (
putEntry) -> {
if (putEntry.failed()) {
context.fail(putEntry.cause());
return;
}
vertx.setTimer(entryTtl + 10,
(timer) -> {
clusterSharedMap.get(key, (getEntry) -> {
if (getEntry.failed()) {
context.fail(getEntry.cause());
}
String result = getEntry.result();
System.out.println("Result: " + result);
context.assertNull(result);
async.complete();
});
});
});
});
});
}