only scheduleForUpdate / flush stamps on PCE

This commit is contained in:
Maxim.Mossienko
2013-06-21 13:48:51 +02:00
parent 5f59ea87e2
commit 4ccaa2d4a9
2 changed files with 20 additions and 13 deletions
@@ -1764,7 +1764,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
}
catch (ProcessCanceledException e) {
cleanFileContent(fc, psiFile);
myChangedFilesCollector.invalidateIndicesForFile(file, true);
myChangedFilesCollector.scheduleForUpdate(file);
throw e;
}
catch (StorageException e) {
@@ -2232,20 +2232,24 @@ public class FileBasedIndexImpl extends FileBasedIndex {
final VirtualFile file = fileContent.getVirtualFile();
final boolean reallyRemoved = myFilesToUpdate.remove(file);
if (reallyRemoved && file.isValid()) {
if (onlyRemoveOutdatedData || isTooLarge(file)) {
// on shutdown there is no need to re-index the file, just remove outdated data from indices
final List<ID<?, ?>> affected = new ArrayList<ID<?, ?>>();
for (final ID<?, ?> indexId : myRequiringContentIndices) { // non requiring content indices should be flushed
if (getInputFilter(indexId).acceptInput(file)) {
affected.add(indexId);
try {
if (onlyRemoveOutdatedData || isTooLarge(file)) {
// on shutdown there is no need to re-index the file, just remove outdated data from indices
final List<ID<?, ?>> affected = new ArrayList<ID<?, ?>>();
for (final ID<?, ?> indexId : myRequiringContentIndices) { // non requiring content indices should be flushed
if (getInputFilter(indexId).acceptInput(file)) {
affected.add(indexId);
}
}
removeFileDataFromIndices(affected, file);
}
else {
indexFileContent(project, fileContent);
}
removeFileDataFromIndices(affected, file);
}
else {
indexFileContent(project, fileContent);
finally {
IndexingStamp.flushCache(file);
}
IndexingStamp.flushCache(file);
}
}
}
@@ -65,8 +65,11 @@ public class UnindexedFilesUpdater implements CacheUpdater {
@Override
public void processFile(final FileContent fileContent) {
myIndex.indexFileContent(myProject, fileContent);
IndexingStamp.flushCache(fileContent.getVirtualFile());
try {
myIndex.indexFileContent(myProject, fileContent);
} finally {
IndexingStamp.flushCache(fileContent.getVirtualFile());
}
}
@Override