zargarf
zargarf

Reputation: 643

spring-session-data-mongodb reactive not cleanig up expired sessions

I'm trying to swap out using spring-session-data-redis for spring-session-data-mongo in a Webflux spring-cloud-gateway. Previously with the redis implementation session information in redis was correctly auto deleted after expiry. However with the reactive mongo implementation this does not seem to be happening, and old session data remains persisted forever. I'm using spring-boot 3.1.5, webflux, reactive mongo with Oauth2 flows in spring-security.

Could someone please clarify whether these sessions are meant to be auto-cleaned up after their expiry? I don't see any additional date-related indices on the collection when the database is autocreated.

dependecies in pom:

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
       <version>3.1.5</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.session</groupId>
      <artifactId>spring-session-data-mongodb</artifactId>
      <version>3.1.3</version>
    </dependency>

Expected behavior Expired sessions should be deleted from Mongodb

Actual behavior Old sessions remain in Mongodb

Reactor Netty version: 1.1.12 JVM version (e.g. java -version): 20

Upvotes: 1

Views: 175

Answers (0)

Related Questions