refactor: original should be removed when session id changed (#5931)

#### What type of PR is this?
/kind improvement
/area core

#### What this PR does / why we need it:
当 session id 改变时清除原来的 session id 记录

#### Does this PR introduce a user-facing change?
```release-note
None
```
pull/5950/head
guqing 2024-05-16 16:32:35 +08:00 committed by GitHub
parent 607898b172
commit 9c98d0a54c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,12 @@ public class InMemoryReactiveIndexedSessionRepository extends ReactiveMapSession
Mono<Void> updateIndex(MapSession session) {
return removeIndex(session.getId())
.then(Mono.defer(() -> {
if (!session.getId().equals(session.getOriginalId())) {
return removeIndex(session.getOriginalId());
}
return Mono.empty();
}))
.then(Mono.defer(() -> {
indexResolver.resolveIndexesFor(session)
.forEach((name, value) -> {