Opened 23 months ago
Last modified 23 months ago
#57221 new enhancement
Opportunity for optimization on invalid query to REST API Search Controller
Reported by: | Starbuck | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | 6.2 |
Component: | REST API | Keywords: | |
Focuses: | Cc: |
Description
Here we see get_items executes a query and gets a list of $ids. Then it loops through all $ids to prepare the response. And then it checks the total number of records to see if the requested page is larger than the number of pages available.
This is a proposal to check $max_pages before the response preparation, to avoid the loop if the request is pre-destined to return an error anyway.
This would only provide a performance benefit on invalid queries. But looking up at line 115, function get_items_permission_check always returns true. I can imagine a DOS where a large number of search queries are queued up just to keep a system busy.