Merge "ReceiveCommits: Retry request validation during auto-close"

This commit is contained in:
Edwin Kempin
2018-01-23 08:39:53 +00:00
committed by Gerrit Code Review

View File

@@ -2923,7 +2923,7 @@ class ReceiveCommits {
for (ReplaceRequest req : replaceAndClose) {
Change.Id id = req.notes.getChangeId();
if (!req.validate(true)) {
if (!executeRequestValidation(() -> req.validate(true))) {
logDebug("Not closing {} because validation failed", id);
continue;
}
@@ -2972,6 +2972,20 @@ class ReceiveCommits {
}
}
private <T> T executeRequestValidation(Action<T> action)
throws IOException, PermissionBackendException, OrmException {
try {
// The request validation needs to do an account query to lookup accounts by preferred email,
// if that index query fails the request validation should be retried.
return retryHelper.execute(ActionType.INDEX_QUERY, action, OrmException.class::isInstance);
} catch (Exception t) {
Throwables.throwIfInstanceOf(t, IOException.class);
Throwables.throwIfInstanceOf(t, PermissionBackendException.class);
Throwables.throwIfInstanceOf(t, OrmException.class);
throw new OrmException(t);
}
}
private void updateAccountInfo() {
if (setFullNameTo == null) {
return;