KEYCLOAK-4593 Flush and clear when fetching multiple realms for performance improvement with large number of realms
This commit is contained in:
parent
a32c8c5190
commit
b6ee342713
1 changed files with 3 additions and 2 deletions
|
@ -117,7 +117,8 @@ public class JpaRealmProvider implements RealmProvider {
|
||||||
for (String id : entities) {
|
for (String id : entities) {
|
||||||
RealmModel realm = session.realms().getRealm(id);
|
RealmModel realm = session.realms().getRealm(id);
|
||||||
if (realm != null) realms.add(realm);
|
if (realm != null) realms.add(realm);
|
||||||
|
em.flush();
|
||||||
|
em.clear();
|
||||||
}
|
}
|
||||||
return realms;
|
return realms;
|
||||||
}
|
}
|
||||||
|
@ -730,4 +731,4 @@ public class JpaRealmProvider implements RealmProvider {
|
||||||
model.setTimestamp(entity.getTimestamp());
|
model.setTimestamp(entity.getTimestamp());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue