commit | 1e3abe8a9eab13c691f1d3143fb145a18008b313 | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Thu Sep 23 14:34:52 2021 +0200 |
committer | Edwin Kempin <ekempin@google.com> | Thu Oct 14 12:44:37 2021 +0200 |
tree | 7d4fc0ebb65b0ad694ca35290a298c6128fc78f0 | |
parent | be9aa10008b5eb4bc4f5ef27dc8dd6bd3a54bbee [diff] |
CodeOwnersOnAddReviewer: Post change message asynchronously Computing the owned path is rather expensive and adds latency to PostReviewers and PostReview calls. Avoid the extra latency by posting the message asynchronously. This is especially important if multiple code owners are added as reviewers at once via PostReview, as in this case the latency increases linearly with the number of added code owners. Posting the change message asynchronously means that possible errors during the posting of the change message are ignored, but we are fine with this since we already have retrying in place, we properly log the error and a missing change message is only a small annoyance, but not a severe issue. For posting the change message asynchronously we must open a request context that provides the current user, otherwise getting the current user in the background thread fails (e.g. the current user is needed as the author of the change message). Posting the change message asynchronously in tests makes the tests prone to fail with LOCK_FAILURE since change updates that are triggered by the tests after adding a reviewer are done in parallel with the asynchronous posting of the change message. While the REST API has retries in place to account for this, the test API does not retry on LOCK_FAILUREs. That's why we disable the asynchronous posting of change messages in tests (via a config option). This also makes the assertions in CodeOwnersOnAddReviewerIT easier since they do not need to wait until the asynchronous posting of the change messages happened before they can assert it. The test in CodeOwnersOnAddReviewerIT that verifies the asynchronous posting of the change message explicitly sets the config parameter to enable asynchronous posting of change messages. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Icb55023c989e3ae14ff64ddc8a79130af71efd92
This plugin provides support for defining code owners for files in a repository.
If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.
Also see resources/Documentation/about.md.
IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.