mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
IJPL-149042 wrap work with channels into try-finally
GitOrigin-RevId: 6854c66fa9ca496ab6c9b24d9c8e1c62db2fc6ed
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4d6044e054
commit
597b3204f9
@@ -157,16 +157,20 @@ internal suspend fun searchAndSendEntities(
|
||||
val classesChannel = if (settings.shouldIndexClasses) Channel<IndexableEntity>(capacity = BUFFER_SIZE) else null
|
||||
val symbolsChannel = if (settings.shouldIndexSymbols) Channel<IndexableEntity>(capacity = BUFFER_SIZE) else null
|
||||
|
||||
if (filesChannel != null) launch { sendEntities(project, IndexId.FILES, filesChannel) }
|
||||
if (classesChannel != null) launch { sendEntities(project, IndexId.CLASSES, classesChannel) }
|
||||
if (symbolsChannel != null) launch { sendEntities(project, IndexId.SYMBOLS, symbolsChannel) }
|
||||
try {
|
||||
if (filesChannel != null) launch { sendEntities(project, IndexId.FILES, filesChannel) }
|
||||
if (classesChannel != null) launch { sendEntities(project, IndexId.CLASSES, classesChannel) }
|
||||
if (symbolsChannel != null) launch { sendEntities(project, IndexId.SYMBOLS, symbolsChannel) }
|
||||
|
||||
coroutineScope {
|
||||
launchSearching(this, filesChannel, classesChannel, symbolsChannel)
|
||||
coroutineScope {
|
||||
launchSearching(this, filesChannel, classesChannel, symbolsChannel)
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// Here all producer coroutines launch from launchSearching finished,
|
||||
// so we can close channels to make consumer coroutines finish
|
||||
filesChannel?.close()
|
||||
classesChannel?.close()
|
||||
symbolsChannel?.close()
|
||||
}
|
||||
// Here all producer coroutines launch from launchSearching finished,
|
||||
// so we can close channels to make consumer coroutines finish
|
||||
filesChannel?.close()
|
||||
classesChannel?.close()
|
||||
symbolsChannel?.close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user