Make indexing more interactive

- update progress each 50ms instead of 200ms
- yield indexing coroutine on each file


(cherry picked from commit 4a09f64132c419b82b71d48704005b8169047d1f)

IJ-CR-148537

GitOrigin-RevId: 9a5622e892d52a33aac1ce81427700932b3293cc
This commit is contained in:
Max Medvedev
2024-11-04 15:52:42 +01:00
committed by intellij-monorepo-bot
parent b877f5f322
commit 96cf4c153e

View File

@@ -38,6 +38,7 @@ import com.intellij.util.indexing.diagnostic.ProjectDumbIndexingHistoryImpl
import com.intellij.util.indexing.events.FileIndexingRequest
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.sync.Mutex
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.TestOnly
import java.io.FileNotFoundException
@@ -131,7 +132,7 @@ class IndexUpdateRunner(
val filesIndexed = AtomicInteger(0)
val progressReportingJob = launch {
while (true) {
delay(200)
delay(50)
val currentlyIndexedFile = currentlyIndexedFileRef.get()
if (currentlyIndexedFile != null) {
val presentableLocation = getPresentableLocationBeingIndexed(project, currentlyIndexedFile)
@@ -194,7 +195,7 @@ class IndexUpdateRunner(
processRequestTask(fileIndexingRequest)
}
ensureActive()
yield()
}
}
//FIXME RC: for profiling, remove afterwards