ursus
12/03/2021, 1:08 AMNick Allen
12/03/2021, 2:24 AMursus
12/03/2021, 3:13 AM@Test
fun foo() {
GlobalScope.launch {
intervalFlow(10)
.collect {
log("---- INTERVAL=$it")
}
}
}
why does the flow stops, it should continue for ever, i.e. a leak, right?Nick Allen
12/03/2021, 3:16 AMfoo()
returns right away (launch
starts the coroutine but then returns immediately). Once it's done, process ends.@Test
fun foo() {
runBlocking { //This blocks test thread
intervalFlow(10)
.collect {
log("---- INTERVAL=$it")
}
}
}
ursus
12/03/2021, 1:12 PMNick Allen
12/04/2021, 12:27 AMursus
12/04/2021, 2:36 AM