Ignore failed rename operation for deleted session

Attempting to change session id for a deleted session currently results in "ERR no such key" error on rename operation of expired key. This commit addressed the problem by ignoring the aforementioned error.

Closes #1137
This commit is contained in:
Vedran Pavic
2018-09-04 00:34:44 +02:00
parent 6208d0298d
commit d3134ad065
2 changed files with 28 additions and 2 deletions

View File

@@ -581,6 +581,22 @@ public class RedisOperationsSessionRepositoryITests extends AbstractRedisITests
assertThat(this.repository.findById(originalId)).isNull();
}
// gh-1137
@Test
public void changeSessionIdWhenSessionIsDeleted() {
RedisSession toSave = this.repository.createSession();
String sessionId = toSave.getId();
this.repository.save(toSave);
this.repository.deleteById(sessionId);
toSave.changeSessionId();
this.repository.save(toSave);
assertThat(this.repository.findById(toSave.getId())).isNull();
assertThat(this.repository.findById(sessionId)).isNull();
}
private String getSecurityName() {
return this.context.getAuthentication().getName();
}