mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Indexing diagnostics: ensure all indexing listeners are called on indexing started/finished.
This is needed to guarantee that the FUS reporter is called for the "started" and "finished" events. GitOrigin-RevId: bacf9183f6c6530beae22b00c5d66d5904e24d7b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9329ef5ac9
commit
bd31ae3093
+24
-3
@@ -8,8 +8,11 @@ import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.diagnostic.ControlFlowException
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.getProjectCachePath
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.util.concurrency.NonUrgentExecutor
|
||||
@@ -84,7 +87,7 @@ class IndexDiagnosticDumper : Disposable {
|
||||
}
|
||||
|
||||
fun onIndexingStarted(projectIndexingHistory: ProjectIndexingHistory) {
|
||||
ProjectIndexingHistoryListener.EP_NAME.forEachExtensionSafe { it.onStartedIndexing(projectIndexingHistory) }
|
||||
runAllListenersSafely { onStartedIndexing(projectIndexingHistory) }
|
||||
}
|
||||
|
||||
fun onIndexingFinished(projectIndexingHistory: ProjectIndexingHistory) {
|
||||
@@ -96,8 +99,26 @@ class IndexDiagnosticDumper : Disposable {
|
||||
return
|
||||
}
|
||||
NonUrgentExecutor.getInstance().execute { dumpProjectIndexingHistoryToLogSubdirectory(projectIndexingHistory) }
|
||||
} finally {
|
||||
ProjectIndexingHistoryListener.EP_NAME.forEachExtensionSafe { it.onFinishedIndexing(projectIndexingHistory) }
|
||||
}
|
||||
finally {
|
||||
runAllListenersSafely { onFinishedIndexing(projectIndexingHistory) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun runAllListenersSafely(block: ProjectIndexingHistoryListener.() -> Unit) {
|
||||
val listeners = ProgressManager.getInstance().computeInNonCancelableSection<List<ProjectIndexingHistoryListener>, Exception> {
|
||||
ProjectIndexingHistoryListener.EP_NAME.extensionList
|
||||
}
|
||||
for (listener in listeners) {
|
||||
try {
|
||||
listener.block()
|
||||
} catch (e: Exception) {
|
||||
if (e is ControlFlowException) {
|
||||
// Make all listeners run first.
|
||||
continue
|
||||
}
|
||||
LOG.error(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user