[indexeing] IJPL-232427: Follow-up -- do not rely on EDT in testing of dumb tasks

GitOrigin-RevId: 2e464b425fccd9b696ef4f87d088ae4606b1b18a
This commit is contained in:
Konstantin Nisht
2026-02-04 18:12:05 +00:00
committed by intellij-monorepo-bot
parent 9c4d0b5539
commit a776057735
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.UserDataHolder
import com.intellij.openapi.wm.ex.ProgressIndicatorEx
import com.intellij.platform.ide.progress.withBackgroundProgress
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
@@ -200,13 +201,15 @@ open class MergingQueueGuiExecutor<T : MergeableQueueTask<T>> protected construc
protected open val taskId: Any? = null
private val schedulingDispatcher = Dispatchers.Default.limitedParallelism(1)
@OptIn(InternalCoroutinesApi::class)
private fun startInBackgroundWithVisibleOrInvisibleProgress(
onCancellation: () -> Unit,
task: (ProgressIndicator) -> Unit,
) {
val actionStarted = AtomicBoolean(false)
project.service<ScopeHolder>().scope.launch {
project.service<ScopeHolder>().scope.launch(schedulingDispatcher) {
withBackgroundProgress(project, myProgressTitle) {
coroutineToIndicator { indicator ->
actionStarted.set(true)