Only compute submittable during submitted_together
The submittable field of ChangeInfo is undocumented and only used by the Submitted Together tab of the web UI. It's also quite costly to compute as the logic currently runs the Prolog rules in the default "accurate" mode, ignoring the setFastEvalLabels(true) mode used by DETAILED_LABELS. Computing submittable for every search result is one of the reasons dashboards are slow on gerrit-review. Each change is run through the full set of rules, which requires group membership checks for every single reviewer vote. These membership lookups take long enough that the sequential evaluation adds up to a noticable delay. Just disable the field, except during the submitted_together API. Change-Id: Iffb893f31c5c01306ace4fb13a43f5f91dd9a2da
This commit is contained in:
parent
44eefb5e79
commit
4cd05b2c5e
@ -4474,6 +4474,9 @@ Not set for merged changes.
|
|||||||
|`mergeable` |optional|
|
|`mergeable` |optional|
|
||||||
Whether the change is mergeable. +
|
Whether the change is mergeable. +
|
||||||
Not set for merged changes, or if the change has not yet been tested.
|
Not set for merged changes, or if the change has not yet been tested.
|
||||||
|
|`submittable` |optional|
|
||||||
|
Whether the change has been approved by the project submit rules. +
|
||||||
|
Provided only by link:#submitted-together[submitted_together].
|
||||||
|`insertions` ||
|
|`insertions` ||
|
||||||
Number of inserted lines.
|
Number of inserted lines.
|
||||||
|`deletions` ||
|
|`deletions` ||
|
||||||
|
@ -481,9 +481,6 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void assertSubmittable(String changeId) throws Exception {
|
protected void assertSubmittable(String changeId) throws Exception {
|
||||||
assertThat(gApi.changes().id(changeId).info().submittable)
|
|
||||||
.named("submit bit on ChangeInfo")
|
|
||||||
.isEqualTo(true);
|
|
||||||
RevisionResource rsrc = parseCurrentRevisionResource(changeId);
|
RevisionResource rsrc = parseCurrentRevisionResource(changeId);
|
||||||
UiAction.Description desc = submitHandler.getDescription(rsrc);
|
UiAction.Description desc = submitHandler.getDescription(rsrc);
|
||||||
assertThat(desc.isVisible()).named("visible bit on submit action").isTrue();
|
assertThat(desc.isVisible()).named("visible bit on submit action").isTrue();
|
||||||
|
@ -169,6 +169,7 @@ public class ChangeJson {
|
|||||||
private final ChangeKindCache changeKindCache;
|
private final ChangeKindCache changeKindCache;
|
||||||
|
|
||||||
private AccountLoader accountLoader;
|
private AccountLoader accountLoader;
|
||||||
|
private boolean includeSubmittable;
|
||||||
private Map<Change.Id, List<SubmitRecord>> submitRecords;
|
private Map<Change.Id, List<SubmitRecord>> submitRecords;
|
||||||
private FixInput fix;
|
private FixInput fix;
|
||||||
|
|
||||||
@ -222,6 +223,11 @@ public class ChangeJson {
|
|||||||
: EnumSet.copyOf(options);
|
: EnumSet.copyOf(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ChangeJson includeSubmittable(boolean include) {
|
||||||
|
includeSubmittable = include;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ChangeJson fix(FixInput fix) {
|
public ChangeJson fix(FixInput fix) {
|
||||||
this.fix = fix;
|
this.fix = fix;
|
||||||
return this;
|
return this;
|
||||||
@ -421,14 +427,16 @@ public class ChangeJson {
|
|||||||
out.topic = in.getTopic();
|
out.topic = in.getTopic();
|
||||||
out.hashtags = cd.hashtags();
|
out.hashtags = cd.hashtags();
|
||||||
out.changeId = in.getKey().get();
|
out.changeId = in.getKey().get();
|
||||||
if (in.getStatus() != Change.Status.MERGED) {
|
if (in.getStatus().isOpen()) {
|
||||||
SubmitTypeRecord str = cd.submitTypeRecord();
|
SubmitTypeRecord str = cd.submitTypeRecord();
|
||||||
if (str.isOk()) {
|
if (str.isOk()) {
|
||||||
out.submitType = str.type;
|
out.submitType = str.type;
|
||||||
}
|
}
|
||||||
out.mergeable = cd.isMergeable();
|
out.mergeable = cd.isMergeable();
|
||||||
|
if (includeSubmittable) {
|
||||||
|
out.submittable = Submit.submittable(cd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
out.submittable = Submit.submittable(cd);
|
|
||||||
Optional<ChangedLines> changedLines = cd.changedLines();
|
Optional<ChangedLines> changedLines = cd.changedLines();
|
||||||
if (changedLines.isPresent()) {
|
if (changedLines.isPresent()) {
|
||||||
out.insertions = changedLines.get().insertions;
|
out.insertions = changedLines.get().insertions;
|
||||||
|
@ -126,6 +126,7 @@ public class SubmittedTogether implements RestReadView<ChangeResource> {
|
|||||||
info.changes = json.create(EnumSet.of(
|
info.changes = json.create(EnumSet.of(
|
||||||
ListChangesOption.CURRENT_REVISION,
|
ListChangesOption.CURRENT_REVISION,
|
||||||
ListChangesOption.CURRENT_COMMIT))
|
ListChangesOption.CURRENT_COMMIT))
|
||||||
|
.includeSubmittable(true)
|
||||||
.formatChangeDatas(cds);
|
.formatChangeDatas(cds);
|
||||||
info.nonVisibleChanges = hidden;
|
info.nonVisibleChanges = hidden;
|
||||||
return info;
|
return info;
|
||||||
|
Loading…
Reference in New Issue
Block a user