stable

Clone or download

Read-only

chore(performance): limit query for users in user list field

As of today, when building the list of users each user need a query to the database to build the PFUser object. While it's not perfect in general, it's killer in case of bind to `registred_users` group with thousands of users. This change introduce many things: - First, when registred_users is part of selected groups, there is no need to query other groups as it already means "all possible users". - Second, when the list is built at least once, it's kept in memory and re-used if there are several fields with the same configuration on the same artifact view. - Third, full users are queried so we can create fullfledged users right away instead of having to re-query everything everytime. All in all, this removes as many SQL queries as number of users on the platform. 5k users => 5k less SQL queries. Part of: request #31598 (Multi)SelectBox field bound to large list of users (5k+) performance issue Change-Id: I665e6b68655e134535b1e6c05a884d95b39765ec

Modified Files

Name
M plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/BindListUserValueGetter.php +17 −13 Go to diff View file
A plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/PlatformUsersGetter.php +34 −0 Go to diff View file
A plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/PlatformUsersGetterDao.php +41 −0 Go to diff View file
A plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/PlatformUsersGetterInstance.php +62 −0 Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List_Bind_Users.php +7 −7 Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List_Bind_UsersValue.php +17 −4 Go to diff View file
M plugins/tracker/tests/unit/Tracker/FormElement/Field/ListFields/Bind/BindListUserValueGetterTest.php +10 −4 Go to diff View file