From cf542ed0c16a652b14e58b5244ef90689d261c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zl=C3=A1mal?= Date: Wed, 13 Sep 2023 07:12:56 +0200 Subject: [PATCH] feat(core): sort users by IDs when synchronizing LDAP - When synchronizing whole LDAP sort processed users by their IDs to get more consistent log output. --- .../cz/metacentrum/perun/ldapc/beans/UserSynchronizer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perun-ldapc/src/main/java/cz/metacentrum/perun/ldapc/beans/UserSynchronizer.java b/perun-ldapc/src/main/java/cz/metacentrum/perun/ldapc/beans/UserSynchronizer.java index 7abb4e888f..c606954103 100644 --- a/perun-ldapc/src/main/java/cz/metacentrum/perun/ldapc/beans/UserSynchronizer.java +++ b/perun-ldapc/src/main/java/cz/metacentrum/perun/ldapc/beans/UserSynchronizer.java @@ -14,7 +14,6 @@ import cz.metacentrum.perun.ldapc.model.PerunUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -22,6 +21,7 @@ import javax.naming.Name; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -115,6 +115,7 @@ public void synchronizeUsers() { log.debug("Getting list of users"); List users = perun.getUsersManagerBl().getUsers(ldapcManager.getPerunSession()); + users.sort(Comparator.comparingInt(User::getId)); Set presentUsers = new HashSet(users.size()); syncExecutor.setCorePoolSize(5);