diff options
author | James Moger <james.moger@gitblit.com> | 2012-08-17 15:35:38 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-08-17 15:35:38 -0400 |
commit | 2a81783f291805594d4b97da6830aee94292f8c8 (patch) | |
tree | 88f684ebc8a2e219de2b0798cfaecfd1cc8b99b8 | |
parent | fee0600989ccc271e3f3b44a06599682698c425f (diff) | |
download | gitblit-2a81783f291805594d4b97da6830aee94292f8c8.tar.gz gitblit-2a81783f291805594d4b97da6830aee94292f8c8.zip |
Eliminated unnecessary repository enumeration (issue 103)
-rw-r--r-- | docs/04_releases.mkd | 1 | ||||
-rw-r--r-- | src/com/gitblit/wicket/pages/RootPage.java | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/docs/04_releases.mkd b/docs/04_releases.mkd index 5c89d9a4..af70dff5 100644 --- a/docs/04_releases.mkd +++ b/docs/04_releases.mkd @@ -11,6 +11,7 @@ If you are updating from an earlier release AND you have indexed branches with t #### fixes
+- Eliminated an unnecessary reopsitory enumeration call on the root page which should result in faster page loads (issue 103)
- Gitblit could not delete a Lucene index in a working copy on index upgrade
- Do not index submodule links (issue 119)
- Restore original user or team object on failure to update (issue 118)
diff --git a/src/com/gitblit/wicket/pages/RootPage.java b/src/com/gitblit/wicket/pages/RootPage.java index 636ed00e..eaa25425 100644 --- a/src/com/gitblit/wicket/pages/RootPage.java +++ b/src/com/gitblit/wicket/pages/RootPage.java @@ -64,6 +64,7 @@ public abstract class RootPage extends BasePage { IModel<String> username = new Model<String>("");
IModel<String> password = new Model<String>("");
+ List<RepositoryModel> repositoryModels = new ArrayList<RepositoryModel>();
public RootPage() {
super();
@@ -223,6 +224,15 @@ public abstract class RootPage extends BasePage { }
}
}
+
+ protected List<RepositoryModel> getRepositoryModels() {
+ if (repositoryModels.isEmpty()) {
+ final UserModel user = GitBlitWebSession.get().getUser();
+ List<RepositoryModel> repositories = GitBlit.self().getRepositoryModels(user);
+ repositoryModels.addAll(repositories);
+ }
+ return repositoryModels;
+ }
protected void addDropDownMenus(List<PageRegistration> pages) {
@@ -231,7 +241,7 @@ public abstract class RootPage extends BasePage { protected List<DropDownMenuItem> getRepositoryFilterItems(PageParameters params) {
final UserModel user = GitBlitWebSession.get().getUser();
Set<DropDownMenuItem> filters = new LinkedHashSet<DropDownMenuItem>();
- List<RepositoryModel> repositories = GitBlit.self().getRepositoryModels(user);
+ List<RepositoryModel> repositories = getRepositoryModels();
// accessible repositories by federation set
Map<String, AtomicInteger> setMap = new HashMap<String, AtomicInteger>();
@@ -307,9 +317,8 @@ public abstract class RootPage extends BasePage { }
protected List<RepositoryModel> getRepositories(PageParameters params) {
- final UserModel user = GitBlitWebSession.get().getUser();
if (params == null) {
- return GitBlit.self().getRepositoryModels(user);
+ return getRepositoryModels();
}
boolean hasParameter = false;
@@ -319,7 +328,7 @@ public abstract class RootPage extends BasePage { String team = WicketUtils.getTeam(params);
int daysBack = params.getInt("db", 0);
- List<RepositoryModel> availableModels = GitBlit.self().getRepositoryModels(user);
+ List<RepositoryModel> availableModels = getRepositoryModels();
Set<RepositoryModel> models = new HashSet<RepositoryModel>();
if (!StringUtils.isEmpty(repositoryName)) {
|