From 7c7e942e29be432c081ff71362a756769e6bbe17 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 14 Mar 2012 16:19:16 -0400
Subject: [PATCH] Removed reference to old css file

---
 src/com/gitblit/LuceneExecutor.java |   49 +++++++++++++++++++++++++------------------------
 1 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/src/com/gitblit/LuceneExecutor.java b/src/com/gitblit/LuceneExecutor.java
index b4e5134..c9e4c73 100644
--- a/src/com/gitblit/LuceneExecutor.java
+++ b/src/com/gitblit/LuceneExecutor.java
@@ -105,26 +105,27 @@
 		Set<String> processed = new HashSet<String>();
 		if (!queue.isEmpty()) {
 			// update the repository Lucene index
-			String repositoryName = null;
-			while ((repositoryName = queue.poll()) != null) {
-				if (processed.contains(repositoryName)) {
+			String name = null;
+			while ((name = queue.poll()) != null) {
+				if (processed.contains(name)) {
 					// skipping multi-queued repository
 					continue;
 				}
 				try {
-					Repository repository = GitBlit.self().getRepository(repositoryName);
+					Repository repository = GitBlit.self().getRepository(name);
 					if (repository == null) {
 						logger.warn(MessageFormat.format(
 								"Lucene executor could not find repository {0}. Skipping.",
-								repositoryName));
+								name));
 						continue;
 					}
-					index(repositoryName, repository);
+					index(name, repository);
 					repository.close();
-					processed.add(repositoryName);
+					System.gc();
+					processed.add(name);
 				} catch (Throwable e) {
 					logger.error(MessageFormat.format("Failed to update {0} Lucene index",
-							repositoryName), e);
+							name), e);
 				}
 			}
 		}
@@ -134,51 +135,51 @@
 	 * Synchronously indexes a repository. This may build a complete index of a
 	 * repository or it may update an existing index.
 	 * 
-	 * @param repositoryName
+	 * @param name
 	 *            the name of the repository
 	 * @param repository
 	 *            the repository object
 	 */
-	public void index(String repositoryName, Repository repository) {
+	public void index(String name, Repository repository) {
 		try {
 			if (JGitUtils.hasCommits(repository)) {
 				if (LuceneUtils.shouldReindex(repository)) {
 					// (re)build the entire index
 					long start = System.currentTimeMillis();
-					IndexResult result = LuceneUtils.reindex(repository);
-					long duration = System.currentTimeMillis() - start;
+					IndexResult result = LuceneUtils.reindex(name, repository);
+					float duration = (System.currentTimeMillis() - start)/1000f;
 					if (result.success) {
 						if (result.commitCount > 0) {
-							String msg = "Built {0} Lucene index from {1} commits in {2} msecs";
-							logger.info(MessageFormat.format(msg, repositoryName,
-									result.commitCount, duration));
+							String msg = "Built {0} Lucene index from {1} commits and {2} files across {3} branches in {4} secs";
+							logger.info(MessageFormat.format(msg, name,
+									result.commitCount, result.blobCount, result.branchCount, duration));
 						}
 					} else {
 						String msg = "Could not build {0} Lucene index!";
-						logger.error(MessageFormat.format(msg, repositoryName));
+						logger.error(MessageFormat.format(msg, name));
 					}
 				} else {
 					// update the index with latest commits
 					long start = System.currentTimeMillis();
-					IndexResult result = LuceneUtils.updateIndex(repository);
-					long duration = System.currentTimeMillis() - start;
+					IndexResult result = LuceneUtils.updateIndex(name, repository);
+					float duration = (System.currentTimeMillis() - start)/1000f;
 					if (result.success) {
 						if (result.commitCount > 0) {
-							String msg = "Updated {0} Lucene index with {1} commits in {2} msecs";
-							logger.info(MessageFormat.format(msg, repositoryName,
-									result.commitCount, duration));
+							String msg = "Updated {0} Lucene index with {1} commits and {2} files across {3} branches in {4} secs";
+							logger.info(MessageFormat.format(msg, name,
+									result.commitCount, result.blobCount, result.branchCount, duration));
 						}
 					} else {
 						String msg = "Could not update {0} Lucene index!";
-						logger.error(MessageFormat.format(msg, repositoryName));
+						logger.error(MessageFormat.format(msg, name));
 					}
 				}
 			} else {
 				logger.info(MessageFormat.format("Skipped Lucene index of empty repository {0}",
-						repositoryName));
+						name));
 			}
 		} catch (Throwable t) {
-			logger.error(MessageFormat.format("Lucene indexing failure for {0}", repositoryName), t);
+			logger.error(MessageFormat.format("Lucene indexing failure for {0}", name), t);
 		}
 	}
 

--
Gitblit v1.9.1