Skip to content

Commit

Permalink
Fix for SessionHandlerTestBase#doTestSessionRetryTimeout
Browse files Browse the repository at this point in the history
Since session flushing is an asynchronous process, the session data may not be removed from the store when the next request is handled.

With manual flushing, we make sure the session store has destroyed the data before responding to the request.
So the next one never gets stale session data.

This will help with Infinispan SharedData map session store testing.

Signed-off-by: Thomas Segismont <[email protected]>
  • Loading branch information
tsegismont committed Nov 15, 2024
1 parent 6cf7e66 commit c425122
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ public void testSessionCookieInvalidatedOnError() throws Exception {
}

protected long doTestSessionRetryTimeout() throws Exception {
router.route().handler(SessionHandler.create(store));
SessionHandler sessionHandler = SessionHandler.create(store);
router.route().handler(sessionHandler);
AtomicReference<Session> rid = new AtomicReference<>();

router.get("/0").handler(rc -> {
Expand All @@ -370,8 +371,8 @@ protected long doTestSessionRetryTimeout() throws Exception {
router.get("/1").handler(rc -> {
rid.set(rc.session());
assertEquals("foo_value", rc.session().get("foo"));
rc.session().destroy();
rc.response().end();
rc.session().destroy();
sessionHandler.flush(rc).onComplete(v -> rc.response().end(), rc::fail);
});
router.get("/2").handler(rc -> {
rid.set(rc.session());
Expand Down

0 comments on commit c425122

Please sign in to comment.