Skip to content

Commit 9a7022b

Browse files
committed
Fix test
1 parent b33c671 commit 9a7022b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

krpc/krpc-test/src/commonMain/kotlin/kotlinx/rpc/krpc/test/KrpcTestServiceBackend.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,19 @@ class KrpcTestServiceBackend : KrpcTestService {
157157
return arg1.count()
158158
}
159159

160+
@OptIn(DelicateCoroutinesApi::class)
161+
@Suppress("detekt.GlobalCoroutineUsage")
160162
override suspend fun incomingStreamSyncCollectMultiple(
161163
arg1: Flow<String>,
162164
arg2: Flow<String>,
163165
arg3: Flow<String>,
164166
): Int {
165-
return arg1.count() + arg2.count() + arg3.count()
167+
// buffer of size 1 may cause lock here without multiple coroutines
168+
return listOf(
169+
GlobalScope.async { arg1.count() },
170+
GlobalScope.async { arg2.count() },
171+
GlobalScope.async { arg3.count() },
172+
).awaitAll().sum()
166173
}
167174

168175
override fun outgoingStream(): Flow<String> {

0 commit comments

Comments
 (0)