fix to preload offline sessions faster

slow loading offline tokens during start up leads to connection timeout
closes #24295
This commit is contained in:
ashwingroot 2023-10-26 19:47:32 +05:30 committed by Alexander Schwartz
parent 5464205ab2
commit dee1cec290

View file

@ -519,12 +519,14 @@ public class JpaUserSessionPersisterProvider implements UserSessionPersisterProv
model.setClientId(clientId); model.setClientId(clientId);
model.setUserSessionId(userSession.getId()); model.setUserSessionId(userSession.getId());
if (userSession instanceof PersistentUserSessionAdapter) {
model.setUserId(((PersistentUserSessionAdapter) userSession).getUserId());
}
else {
UserModel user = userSession.getUser(); UserModel user = userSession.getUser();
if (user != null) { if (user != null) {
model.setUserId(user.getId()); model.setUserId(user.getId());
} }
else if (userSession instanceof PersistentUserSessionAdapter) {
model.setUserId(((PersistentUserSessionAdapter) userSession).getUserId());
} }
model.setTimestamp(entity.getTimestamp()); model.setTimestamp(entity.getTimestamp());
model.setData(entity.getData()); model.setData(entity.getData());