Run change hooks and ref-updated events after indexing is done.

The change hooks and ref-updated events were run parallel to the
change (re)indexing. This meant that an event-stream sent events
to the clients before the change indexing was finished. If a client
queried for that change immediately after receiving the event it
happened that the response was not-found as the indexing wasn't yet
done.

Although we haven't had issues with a ref-updated event processors,
firing this event will also wait for the indexing task to finish
as we never know if a ref-updated event processor may trigger a
change query.

Change-Id: Iff17c5aeb9675f3991f938d31ef5048ef5b3b956
This commit is contained in:
Saša Živkov
2014-08-01 16:33:31 +02:00
committed by Hugo Arès
parent 70b4f8f703
commit 22e43cc823
10 changed files with 52 additions and 53 deletions

View File

@@ -120,13 +120,13 @@ public class Restore implements RestModifyView<ChangeResource, RestoreInput>,
} catch (Exception e) {
log.error("Cannot email update for change " + change.getChangeId(), e);
}
f.checkedGet();
hooks.doChangeRestoredHook(change,
caller.getAccount(),
db.patchSets().get(change.currentPatchSetId()),
Strings.emptyToNull(input.message),
dbProvider.get());
ChangeInfo result = json.format(change);
f.checkedGet();
return result;
}