znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
343 stars 83 forks source link

Optimized user and customer lists generation #388

Open pboguslawski opened 1 year ago

pboguslawski commented 1 year ago

Proposed change

When searching for users in AdminUser, customer users in AdminCustomerUser and customer companies in AdminCustomerUser Znuny executes two queries against all backends: one with limit and second with limit + 1 just to decide if "more available" should be displayed in list header.

This mod changes this behaviour to execute only one query against each backend (with limit+1) and trim results to limit which avoids redundant backend (i.e. DB) queries.

This mod also changes way how limit passed to function call is compared against limits defined in backend configuration - now the lesser limit wins which is safer (admin when configuring limit in backend hopes it won't be exceed; the only exception is Limit = 0 which works without changes and searches without limits).

This mod also limits number of items returned in functions above to 400 (hardcoded) even if many backends are present (without this mod Znuny limits display to 400 * # of backends which may produce large web pages in case of many backends with lots of items).

Type of change

Additional information

Related: https://github.com/OTRS/otrs/pull/1468 Author-Change-Id: IB#1055556

Checklist