mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-149752 Scanning should increase mod count only when dumb indexing won't be scheduled
GitOrigin-RevId: 6db0454e2eb414923d2c081529cc7a9582286bbb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2a61a4e3f6
commit
bd74609761
@@ -152,18 +152,20 @@ class PerProjectIndexingQueue(private val project: Project) {
|
||||
@Volatile
|
||||
private var allowFlushing: Boolean = true
|
||||
|
||||
fun flushNow(reason: String) {
|
||||
fun flushNow(reason: String): Boolean {
|
||||
if (!allowFlushing) {
|
||||
LOG.info("Flushing is not allowed at the moment")
|
||||
return
|
||||
return false
|
||||
}
|
||||
val snapshot = getAndResetQueuedFiles()
|
||||
if (snapshot.size > 0) {
|
||||
return if (snapshot.size > 0) {
|
||||
// note that DumbModeWhileScanningTrigger will not finish dumb mode until scanning is finished
|
||||
UnindexedFilesIndexer(project, snapshot, reason).queue(project)
|
||||
true
|
||||
}
|
||||
else {
|
||||
LOG.info("Finished for " + project.name + ". No files to index with loading content.")
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,10 @@ class UnindexedFilesScannerExecutorImpl(private val project: Project, cs: Corout
|
||||
} finally {
|
||||
// Scanning may throw exception (or error).
|
||||
// In this case, we should either clear or flush the indexing queue; otherwise, dumb mode will not end in the project.
|
||||
project.service<PerProjectIndexingQueue>().flushNow(task.task.indexingReason)
|
||||
val indexingScheduled = project.service<PerProjectIndexingQueue>().flushNow(task.task.indexingReason)
|
||||
if (!indexingScheduled) {
|
||||
modCount.incrementAndGet()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,7 +142,6 @@ class UnindexedFilesScannerExecutorImpl(private val project: Project, cs: Corout
|
||||
// We don't care about finishing scanning without a write action. This looks harmless at the moment
|
||||
isRunning.value = false
|
||||
startedOrStoppedEvent.getAndUpdate(Int::inc)
|
||||
modCount.incrementAndGet()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user