mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
during forceUpdate contribute to other indexed projects only from time to time (IDEA-139951)
This commit is contained in:
@@ -2206,6 +2206,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
|
||||
private final VirtualFileUpdateTask myForceUpdateTask = new VirtualFileUpdateTask();
|
||||
private final AtomicInteger myForceUpdateRequests = new AtomicInteger();
|
||||
|
||||
private void forceUpdate(@Nullable Project project, @Nullable final GlobalSearchScope filter, @Nullable final VirtualFile restrictedTo) {
|
||||
myChangedFilesCollector.tryToEnsureAllInvalidateTasksCompleted();
|
||||
@@ -2213,9 +2214,11 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
Collection<VirtualFile> allFilesToUpdate = getAllFilesToUpdate();
|
||||
|
||||
if (!allFilesToUpdate.isEmpty()) {
|
||||
boolean includeFilesFromOtherProjects = (myForceUpdateRequests.incrementAndGet() & 0x3F) == 0;
|
||||
List<VirtualFile> virtualFilesToBeUpdatedForProject = ContainerUtil.filter(
|
||||
allFilesToUpdate,
|
||||
new ProjectFilesCondition(projectIndexableFiles(project), filter, restrictedTo)
|
||||
new ProjectFilesCondition(projectIndexableFiles(project), filter, restrictedTo,
|
||||
includeFilesFromOtherProjects)
|
||||
);
|
||||
|
||||
if (!virtualFilesToBeUpdatedForProject.isEmpty()) {
|
||||
|
||||
@@ -29,10 +29,15 @@ class ProjectFilesCondition implements Condition<VirtualFile> {
|
||||
|
||||
public ProjectFilesCondition(FileBasedIndexImpl.ProjectIndexableFilesFilter indexableFilesFilter,
|
||||
GlobalSearchScope filter,
|
||||
VirtualFile restrictedTo) {
|
||||
VirtualFile restrictedTo,
|
||||
boolean includeFilesFromOtherProjects
|
||||
) {
|
||||
myRestrictedTo = restrictedTo;
|
||||
myFilter = filter;
|
||||
myIndexableFilesFilter = indexableFilesFilter;
|
||||
if (!includeFilesFromOtherProjects) {
|
||||
myFilesFromOtherProjects = MAX_FILES_TO_UPDATE_FROM_OTHER_PROJECT;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user