Slow user and group autocomplete - excessive API requests are sent
Summary
On the general settings page for a project, the user and group autocomplete for merge request approvers is slow due to excessive API requests being sent.
For each letter typed into the search field, two requests are sent; one for user, one for groups. There is not debounce. Nor is the previous request cancelled. If the requests do not get their response in sequential order (not guaranteed) the suggestions might even regress - the correct suggestion for the last request might be replaced by the suggestion for a previous search string.
Steps to reproduce
- Pick a project
- Click Settings - General in left hand menu
- Expand "Merge request settings"
- Open the browser debug tool's network tab
- Type a name in the search box
- Observe the massive list of outgoing requests
What is the current bug behavior?
- Each letter typed fires off two API requests, one for users.json, one for groups.json - there is no debounce, leading to excessive server load.
- Previous requests are not cancelled - the wrong suggestion is sometimes shown.
- Suggestion is only shown when last request get a response.
The first request responds in 4 seconds, quite ok since gitlab status is quite bad at this time. Unfortunately the suggestion is not shown, the loading spinner is still shown until the last requests get their response - which is currently takes about 80-100 seconds when a 8-letter name is typed into the search field.
What is the expected correct behavior?
- The text box input handler should be debounced.
- The currently outstanding requests should be cancelled when a new request is made - to guarantee that the result for the last typed search string is shown.
- At the least the suggestion should be shown when a response is received, not when the last response is received.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com