Rewrite remote oracle wrapper to reduce requests
Gerrit was sending a suggest request roughly for every key typed. On a slow connection (or a slow server) this behavior caused a lot of suggestion requests whose results were immediately useless when the next key was processed. Wrap the reviewer suggestion with RemoteSuggestOracle, which allows at most one remote query to execute at a time. Intermediate queries are discarded, reducing the number of remote calls made by the UI when the user is typing faster than the network+server can process. This somewhat improves suggestion experience for reviewers on a slow site. Typing "John D<enter>" is now more likely to complete to a person named "John Doe" rather than "John Alberts", which was being selected from a stale result based on the "John" suggestion list. Change-Id: I9bfaa2fe5bd92bbbf38c086f7c909761854d718d
This commit is contained in:
@@ -21,7 +21,7 @@ import com.google.gerrit.client.groups.GroupInfo;
|
||||
import com.google.gerrit.client.rpc.GerritCallback;
|
||||
import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
|
||||
import com.google.gerrit.client.ui.OnEditEnabler;
|
||||
import com.google.gerrit.client.ui.RPCSuggestOracle;
|
||||
import com.google.gerrit.client.ui.RemoteSuggestOracle;
|
||||
import com.google.gerrit.client.ui.SmallHeading;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -120,7 +120,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
ownerTxtBox = new NpTextBox();
|
||||
ownerTxtBox.setVisibleLength(60);
|
||||
final AccountGroupSuggestOracle accountGroupOracle = new AccountGroupSuggestOracle();
|
||||
ownerTxt = new SuggestBox(new RPCSuggestOracle(
|
||||
ownerTxt = new SuggestBox(new RemoteSuggestOracle(
|
||||
accountGroupOracle), ownerTxtBox);
|
||||
ownerTxt.setStyleName(Gerrit.RESOURCES.css().groupOwnerTextBox());
|
||||
ownerPanel.add(ownerTxt);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
package com.google.gerrit.client.admin;
|
||||
|
||||
import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
|
||||
import com.google.gerrit.client.ui.RPCSuggestOracle;
|
||||
import com.google.gerrit.client.ui.RemoteSuggestOracle;
|
||||
import com.google.gerrit.common.data.GroupReference;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwt.editor.client.LeafValueEditor;
|
||||
@@ -53,7 +53,7 @@ public class GroupReferenceBox extends Composite implements
|
||||
textBox = new NpTextBox();
|
||||
oracle = new AccountGroupSuggestOracle();
|
||||
suggestBox = new SuggestBox( //
|
||||
new RPCSuggestOracle(oracle), //
|
||||
new RemoteSuggestOracle(oracle), //
|
||||
textBox, //
|
||||
suggestions);
|
||||
initWidget(suggestBox);
|
||||
|
||||
Reference in New Issue
Block a user