We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b6e311 commit 8009b36Copy full SHA for 8009b36
kotlinx-coroutines-core/jvm/test/channels/ChannelAtomicCancelStressTest.kt
@@ -115,7 +115,12 @@ class ChannelAtomicCancelStressTest(private val kind: TestChannelKind) : TestBas
115
else -> error("cannot happen")
116
}
117
lastSent = trySend // update on success
118
- if (counter++ % 1000 == 0) yield() // yield periodically to check cancellation on LinkedListChannel
+ when {
119
+ // must artificially slow down LINKED_LIST sender to avoid overwhelming receiver and going OOM
120
+ kind == TestChannelKind.LINKED_LIST -> while (lastSent > lastReceived + 100) yield()
121
+ // yield periodically to check cancellation on conflated channels
122
+ kind.isConflated -> if (counter++ % 100 == 0) yield()
123
+ }
124
125
126
0 commit comments