-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve LDAP performances when updating records, especially when many user entries exists #1975
base: dev
Are you sure you want to change the base?
Conversation
Not sure about your last commits on |
@@ -246,7 +246,7 @@ def _apply( | |||
ldap = _get_ldap_interface() | |||
ldap.update( | |||
"cn=admins,ou=sudo", | |||
{"sudoOption": ["!authenticate"] if passwordless_sudo else []}, | |||
{"sudoOption": "!authenticate" if passwordless_sudo else set()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sooo does this mean now the code magically handle the case where the data is a string (and won't interpret a string as a list of char) ?
# If the requested mail address is already as main address or as an alias by this user | ||
if mail in user["mail"]: | ||
user["mail"].remove(mail) | ||
if mail != user["mail"][0]: | ||
user["mail"].remove(mail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to fully understand that bit but my brain is not super fresh right now
if mail in user["mail"]: | ||
user["mail"].remove(mail) | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not sure to understand this bit
new_attr_dict["givenName"] = [firstname] # TODO: Validate | ||
new_attr_dict["cn"] = new_attr_dict["displayName"] = [ | ||
(firstname + " " + user["sn"][0]).strip() | ||
] | ||
new_attr_dict["givenName"] = firstname # TODO: Validate | ||
new_attr_dict["cn"] = new_attr_dict["displayName"] = ( | ||
firstname + " " + user["sn"][0] | ||
).strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are similar stuff in portal.py
's portal_update()
that need to be adapted too
] | ||
if new_attr_dict["mail"]: | ||
new_attr_dict["objectClass"] = set(group["objectClass"]) | ||
new_attr_dict["objectClass"].update({"mailGroup"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new_attr_dict["objectClass"].update({"mailGroup"}) | |
new_attr_dict["objectClass"].add("mailGroup") |
The problem
With 150 users and 12 apps, a
yunohost user create
take 1minWith 350 users and ~25 apps, a
yunohost user create
take hours maybe days.Solution
Replace
ldap.modlist.modifyModlist
by an optimize code that work for yunohost.Test in a dev platforme (with ssd 600Mbps) : the 169th user creation is made in ~3s.
PR Status
Need more test to be sure it doesn't break something...
How to test