commit | 0021eafa47500a008367d98d6fa6e599eeb8e952 | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Wed Apr 21 10:06:20 2021 +0200 |
committer | Edwin Kempin <ekempin@google.com> | Wed Apr 21 10:06:33 2021 +0200 |
tree | 5cdd5457ae0010558dcab855edacc756e12fa058 | |
parent | 5feb3fd01007e0d9f66fc14759df0e71c7690de6 [diff] |
Cache all parsed config values to avoid reparsing them The code-owners plugin has quite a lot of configuration parameters that are accessed frequently. If reading config parameters is slow, this can sum up to a significant amount of latency. What we have done so far is that CodeOwnersPluginConfigSnapshot which reads the project specific plugin configuration is cached for the time of the request (see change If541bc329). This avoids loading the code-owners.config file from this project and the parent projects again and again. However whenever a config parameter is needed, we still reparse it each time. Parsing a config parameter means inspecting the Config that was read from the code-owners.config files and if necessary fall-back to inspecting the Config that was read from gerrit.config. With this change we do the parsing only once and cache the result in CodeOwnersPluginConfigSnapshot. In addition to project specific configuration parameters that are handled by CodeOwnersPluginConfigSnapshot there are also a couple of global configuration parameters that are handled in CodeOwnersPluginConfiguration. For the global parameters we have the same problem that they are reparsed on each access. E.g. the allowed email domains are parsed each time a code owner email is resolved to an account. This can be the reason why the step that resolves code owner emails to accounts is rather slow. To address this we follow the example of CodeOwnersPluginConfigSnapshot and add a CodeOwnersPluginGlobalConfigSnapshot class that handles the reading of the global config parameters. Same as CodeOwnersPluginConfigSnapshot it is cached for the request time and internally it caches the parsed config values so that they need to parsed only once. To make it clearer that CodeOwnersPluginConfigSnapshot is about reading project-specific configuration parameters, it is renamed to CodeOwnersPluginProjectConfigSnapshot. Change-Id: I6e4c608133717b598d356d1ce76246eb19b08c4b Signed-off-by: Edwin Kempin <ekempin@google.com>
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.