Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: editor/tools/plugins/com.google.dart.indexer/src/com/google/dart/indexer/workspace/driver/WorkspaceIndexingDriver.java

Issue 8639005: Fix for issue http://code.google.com/p/dart/issues/detail?id=544 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.indexer/src/com/google/dart/indexer/workspace/driver/WorkspaceIndexingDriver.java
===================================================================
--- editor/tools/plugins/com.google.dart.indexer/src/com/google/dart/indexer/workspace/driver/WorkspaceIndexingDriver.java (revision 1753)
+++ editor/tools/plugins/com.google.dart.indexer/src/com/google/dart/indexer/workspace/driver/WorkspaceIndexingDriver.java (working copy)
@@ -118,6 +118,13 @@
private final IndexingJob indexingJob = new IndexingJob();
+ /**
+ * The number of milliseconds we should wait for the indexer to finish before trying again to
+ * execute a query.
+ */
+ // TODO(devoncarew): why 1000ms here?
+ private static final int WAIT_INTERVAL = 1000;
+
public WorkspaceIndexingDriver(IndexConfigurationInstance configuration) {
this.configuration = configuration;
IWorkspace workspace = ResourcesPlugin.getWorkspace();
@@ -151,6 +158,7 @@
*/
public void enqueueChangedFiles(IFile[] changedFiles) {
indexer.enqueueChangedFiles(changedFiles);
+ workAdded();
}
/**
@@ -160,6 +168,7 @@
*/
public void enqueueTargets(IndexingTarget[] targets) {
indexer.enqueueTargets(targets);
+ workAdded();
}
public void execute(Query query) throws IndexTemporarilyNonOperational {
@@ -167,21 +176,21 @@
synchronized (indexer) {
indexer.prioritizeQuery(query);
try {
- long start = System.currentTimeMillis();
+ boolean hasBeenScheduled = false;
while (!isShutdown) {
try {
indexer.execute(query);
break;
} catch (IndexRequiresFullRebuild e) {
} catch (IndexIsStillBuilding e) {
+ // If we're waiting for the index to be built, then make sure that the indexer job has
+ // been scheduled so that we don't wait forever.
+ if (!hasBeenScheduled) {
+ indexingJob.schedule();
+ hasBeenScheduled = true;
+ }
}
- long delta = System.currentTimeMillis() - start;
- if (delta > 5000) {
- throw new IndexTemporarilyNonOperational("Gave up waiting for indexer after " + delta
- + " ms");
- }
- // TODO(devoncarew): why 1000ms here?
- indexer.wait(1000);
+ indexer.wait(WAIT_INTERVAL);
}
} finally {
indexer.unprioritizeQuery(query);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698