Skip to content

Commit

Permalink
fix ChunkedLatestFlowTest was failing in some runner
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-chung committed Nov 8, 2024
1 parent ed7083c commit 17b5ff3
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ class ChunkedLatestFlowTest {

coroutineScope {
flow<Int> {
val startTime = System.currentTimeMillis()
(0..10).forEach {
emit(it)
delay(1450)
val currTime = System.currentTimeMillis()
println("t=${currTime - startTime}: $it")
delay((it + 1) * 145 - (currTime - startTime))
}
}
.chunkedLatest(5000.milliseconds())
.chunkedLatest(500.milliseconds())
.onEach { results += it }
.launchIn(this)
}
Expand All @@ -43,14 +46,17 @@ class ChunkedLatestFlowTest {

coroutineScope {
flow<Int> {
val startTime = System.currentTimeMillis()
(0..10).forEach {
emit(it)
delay(1450)
val currTime = System.currentTimeMillis()
println("t=${currTime - startTime}: $it")
delay((it + 1) * 145 - (currTime - startTime))
}
emit(11)
emit(12)
}
.chunkedLatest(5000.milliseconds())
.chunkedLatest(500.milliseconds())
.onEach { results += it }
.launchIn(this)
}
Expand All @@ -66,12 +72,15 @@ class ChunkedLatestFlowTest {

coroutineScope {
flow<Int> {
val startTime = System.currentTimeMillis()
(0..12).forEach {
emit(it)
delay(1450)
val currTime = System.currentTimeMillis()
println("t=${currTime - startTime}: $it")
delay((it + 1) * 145 - (currTime - startTime))
}
}
.chunkedLatest(5000.milliseconds())
.chunkedLatest(500.milliseconds())
.onEach { results += it }
.launchIn(this)
}
Expand Down

0 comments on commit 17b5ff3

Please sign in to comment.