mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[find in files] IJPL-205277 add buffer to improve performance and responsiveness
GitOrigin-RevId: e0f3446c9b0b26774de82af695877f49e5b8eb60
This commit is contained in:
committed by
intellij-monorepo-bot
parent
524e00b045
commit
5fc984e1bc
@@ -31,6 +31,7 @@ import fleet.rpc.client.RpcTimeoutException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.flow.buffer
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.take
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -86,10 +87,13 @@ open class FindAndReplaceExecutorImpl(val coroutineScope: CoroutineScope) : Find
|
||||
projectId = project.projectId(),
|
||||
filesToScanInitially = filesToScanInitially.map { it.rpcId() },
|
||||
maxUsagesCount = maxUsagesCount
|
||||
).let {
|
||||
if (shouldThrottle) it.throttledWithAccumulation()
|
||||
else it.map { event -> ThrottledOneItem(event) }
|
||||
}.take(maxUsagesCount).collect { throttledItems ->
|
||||
).take(maxUsagesCount)
|
||||
.buffer(capacity = maxUsagesCount)
|
||||
.let {
|
||||
if (shouldThrottle) it.throttledWithAccumulation()
|
||||
else it.map { event -> ThrottledOneItem(event) }
|
||||
}
|
||||
.collect { throttledItems ->
|
||||
if (searchDisposable?.isDisposed == true) {
|
||||
return@collect
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user