Avoid sorting items returned from the database which are already stable
Closes #29319 Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
b01e47feec
commit
673e122443
1 changed files with 1 additions and 3 deletions
|
@ -68,7 +68,6 @@ import org.keycloak.models.utils.UserModelDelegate;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -397,8 +396,7 @@ public class PersistentUserSessionProvider implements UserSessionProvider, Sessi
|
||||||
protected Stream<UserSessionModel> getUserSessionsStream(final RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults, final boolean offline) {
|
protected Stream<UserSessionModel> getUserSessionsStream(final RealmModel realm, ClientModel client, Integer firstResult, Integer maxResults, final boolean offline) {
|
||||||
UserSessionPredicate predicate = UserSessionPredicate.create(realm.getId()).client(client.getId());
|
UserSessionPredicate predicate = UserSessionPredicate.create(realm.getId()).client(client.getId());
|
||||||
|
|
||||||
return paginatedStream(getUserSessionsStream(realm, predicate, offline)
|
return paginatedStream(getUserSessionsStream(realm, predicate, offline), firstResult, maxResults);
|
||||||
.sorted(Comparator.comparing(UserSessionModel::getLastSessionRefresh)), firstResult, maxResults);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue