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
10 files changed