Skip to content

Commit

Permalink
code: Fix svn repository code browsing cache bug
Browse files Browse the repository at this point in the history
  • Loading branch information
doortts committed Apr 25, 2017
1 parent 7a57e89 commit 7f065fe
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/controllers/CodeApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,22 @@ public static Result codeBrowserWithBranch(String owner, String projectName, Str

PlayRepository repository = RepositoryService.getRepository(project);
List<String> branches = repository.getRefNames();
String cacheKey = owner + ":" + projectName + ":" + branch + ":" + path + ":" + project.lastUpdateDate().getTime();
List<ObjectNode> recursiveData = (List<ObjectNode>) Cache.get(cacheKey);
if( recursiveData == null){
List<ObjectNode> recursiveData = null;

if(RepositoryService.VCS_GIT.equals(project.vcs)){
String cacheKey = owner + ":" + projectName + ":" + branch + ":" + path + ":" + project.lastUpdateDate().getTime();

recursiveData = (List<ObjectNode>) Cache.get(cacheKey);
if( recursiveData == null){
recursiveData = RepositoryService.getMetaDataFromAncestorDirectories(
repository, branch, path);
Cache.set(cacheKey, recursiveData);
}
} else if (RepositoryService.VCS_SUBVERSION.equals(project.vcs)){ // svn doesn't use cache
recursiveData = RepositoryService.getMetaDataFromAncestorDirectories(
repository, branch, path);
Cache.set(cacheKey, recursiveData);
}

if (recursiveData == null) {
return notFound(ErrorViews.NotFound.render(branch, project, "code"));
}
Expand Down

0 comments on commit 7f065fe

Please sign in to comment.