Fix cache eviction upon project import from GitHub The import phase from GitHub has three steps: 1. create a Gerrit project with the correct public/private parent 2. configure the project's ACLs 3. import existing commits from GitHub The project cache would not needed to be evicted, in theory. However, after step 1 the project entry is in the projects cache, but not its ACLs. The step 2 therefore would need to wait the projects cache TTL for allowing the ACLs to be taken into consideration, which would take up to 1h by default. Add an explicit evict after step 2, so that ACLs have immediate effect. Tested manually and verified that: - Without this change, the ACLs are not used until the projects cache are flused - With this change, the ACLs are immediately used right after the project import. Change-Id: I02880564562f170ef0a73bcec56dd37d39930d7a
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java index f25e6ee..7147d54 100644 --- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java +++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/CreateProjectStep.java
@@ -178,7 +178,7 @@ progress.update(1); md.setMessage("Imported from " + getSourceUri()); projectConfig.commit(md); - projectCache.onCreateProject(getProjectNameKey()); + projectCache.evict(getProjectNameKey()); } finally { if (md != null) { md.close();