1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-22 14:15:45 +00:00

updates after coroutines version change

This commit is contained in:
2020-10-27 15:11:57 +06:00
parent d8dbbdf549
commit 6d782f28c3
4 changed files with 9 additions and 5 deletions

View File

@@ -13,10 +13,11 @@ fun <T> aggregateFlows(
vararg flows: Flow<T>,
internalBufferSize: Int = Channel.BUFFERED
): Flow<T> {
val sharedFlow = MutableSharedFlow<T>(extraBufferCapacity = internalBufferSize)
val bc = BroadcastChannel<T>(internalBufferSize)
flows.forEach {
it.onEach {
safely { bc.send(it) }
safely { sharedFlow.emit(it) }
}.launchIn(withScope)
}
return bc.asFlow()