We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I'm using
I'm trying to expire sessions for current user:
@GetMapping("kill_my_sessions") public ResponseEntity<?> killMySessions() { final var currentUserId = currentUserService.getId().toString(); // All user sessions var sessions = mongoOperationsSessionRepository .findByIndexNameAndIndexValue( FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, currentUserId); // Expiring all user sessions sessions.forEach((id, session) -> { session.isExpired(); // false session.setExpireAt(new Date()); session.isExpired(); // true mongoOperationsSessionRepository.save(session); // ok }); return ResponseEntity.ok().build(); }
BUT some other thread executes save() method with old not-expired session and overwrites expired session in DB after all sessions were expired.
save()
spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoOperationsSessionRepository.java
Line 97 in e4f85bc
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello, I'm using
I'm trying to expire sessions for current user:
BUT some other thread executes
save()
method with old not-expired session and overwrites expired session in DB after all sessions were expired.spring-session-data-mongodb/src/main/java/org/springframework/session/data/mongo/MongoOperationsSessionRepository.java
Line 97 in e4f85bc
So, should
save()
do check for the session expiration in DB before save? Thank you.The text was updated successfully, but these errors were encountered: