diff --git a/app/src/main/java/com/example/research/common/progress/DictionaryPipelineCoordinator.kt b/app/src/main/java/com/example/research/common/progress/DictionaryPipelineCoordinator.kt index 8325335..2713e66 100644 --- a/app/src/main/java/com/example/research/common/progress/DictionaryPipelineCoordinator.kt +++ b/app/src/main/java/com/example/research/common/progress/DictionaryPipelineCoordinator.kt @@ -8,11 +8,9 @@ import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job -import kotlinx.coroutines.delay import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import java.io.File -import kotlin.time.Duration.Companion.seconds class DictionaryPipelineCoordinator( private val scope: CoroutineScope, @@ -62,7 +60,9 @@ class DictionaryPipelineCoordinator( pipelineJob?.cancel() pipelineJob = scope.launch(launchDispatcher) { val dir = File(dictionaryPath()) - val filesBeforeReindex = dir.listFiles()?.map { it.name }?.toSet() ?: emptySet() + val filesBeforeReindex = withContext(ioDispatcher) { + dir.listFiles()?.map { it.name }?.toSet() ?: emptySet() + } try { triggerReindexing(isImport) if (isImport) { @@ -95,7 +95,6 @@ class DictionaryPipelineCoordinator( private suspend fun triggerReindexing(isImport: Boolean) = withContext(ioDispatcher) { steps.waitForIndexingCompletion() - delay(1.seconds) val path = dictionaryPath() if (isImport) {