From 0a2f13a555980f5e3d5e2f74f09ae144f790dd9b Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 24 Oct 2018 18:25:00 -0700 Subject: [PATCH] Add StoredValues.REPO_MANAGER First customer will be the find-owners plugin to check owner approval at change submit time, when it might need to include/read OWNERS files in different repositories. OwnersDb is cached to avoid repeated access to the same OWNERS files. Change-Id: If94c29d961807daf961bfa6f2e6ffed4e9731d6c --- .../com/google/gerrit/server/rules/StoredValues.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/java/com/google/gerrit/server/rules/StoredValues.java b/java/com/google/gerrit/server/rules/StoredValues.java index 8b9cfe3fdb..a712635a3e 100644 --- a/java/com/google/gerrit/server/rules/StoredValues.java +++ b/java/com/google/gerrit/server/rules/StoredValues.java @@ -110,6 +110,18 @@ public final class StoredValues { } }; + // Accessing GitRepositoryManager could be slow. + // It should be minimized or cached to reduce pause time + // when evaluating Prolog submit rules. + public static final StoredValue REPO_MANAGER = + new StoredValue() { + @Override + public GitRepositoryManager createValue(Prolog engine) { + PrologEnvironment env = (PrologEnvironment) engine.control; + return env.getArgs().getGitRepositoryManager(); + } + }; + public static final StoredValue REPOSITORY = new StoredValue() { @Override