dave08
08/25/2019, 7:33 AMdave08
08/25/2019, 7:34 AMursus
08/25/2019, 8:14 AMursus
08/25/2019, 8:15 AMRyan Mentley
08/28/2019, 12:40 AMthana
08/28/2019, 5:49 AMsvenjacobs
08/28/2019, 1:25 PMChannel
with Flow
for my API requests. Using Firebase Firestore here and want to listen for document updates. As of now I create a Channel
, then on the Firestore Query
I call `addSnapshotListener()`and inside the listener I call channel.offer()
when there are snapshots incoming. Also I call channel.invokeOnClose { registration.remove() }
where registration
is the ListenerRegistration
returned by addSnapshotListener
. How do I perform the last step with Flow
, ensuring that no listeners are leaked?myanmarking
08/28/2019, 2:13 PMfun onViewAttached(textChanged: Flow<String>) {
mainScope.launch {
textChanged
.onStart { emit("") }
.debounce(700)
.flatMapLatest { pagedListManager.buildDataSource(it) }
.collect {
postEvent(TvShowViewStates.ShowTvShow(it))
}
}
}
myanmarking
08/28/2019, 2:13 PMmyanmarking
08/28/2019, 2:25 PMmyanmarking
08/28/2019, 2:25 PMpublic fun <T> Flow<T>.debounce(skipFirst: Boolean, timeoutMillis: Long): Flow<T> {
var isFirst = true
return flow {
if (skipFirst && isFirst) {
isFirst = false
collect { emit(it) }
} else {
map { debounce(timeoutMillis) }
}
}
}
Joost de Vries
08/29/2019, 5:44 AMInappropriate blocking method call
when somebody accidentally calls blocking from a suspend function. Is it possible to get that warning in gradle as well? Or is there another way to have CI build fail when this happens?roy
08/30/2019, 7:49 AMYasir Ali
08/30/2019, 9:37 AMasad.awadia
08/30/2019, 9:35 PMasad.awadia
08/30/2019, 9:36 PMthana
09/02/2019, 7:51 AM@Timed
annotation on a suspend fun
?thana
09/02/2019, 9:56 AMMDCContext
into the coroutine context once and can read the values from any child context, but only if i modify the MDC
i have to recteate the MDCContext
, right?synhershko
09/03/2019, 7:27 AMbc
) with multiple consumers, each process the messages from bc
and sends messsages to another “sink” channel t
. The “sink” channel is defined as val t = Channel<Tag>(Channel.UNLIMITED)
and I can consistently reproduce a situation where messages are sent to it but the consumer of t
never sees them. If I change t’s definition to val t = Channel<Tag>()
- meaning changing from UNLIMITED to RENDEZVOUS - all works as expected (no messages are dropped). Any idea what’s going on?David Glasser
09/08/2019, 7:14 PM"epollEventLoopGroup-4-3 @call-handler#1379475" #50 prio=10 os_prio=0 tid=0x00007fbe1c05fec0 nid=0x42 runnable [0x00007fbe22efb000]
java.lang.Thread.State: RUNNABLE
at com.yourkit.runtime.Callback.setEventTableStringColumn(Native Method)
at com.yourkit.runtime.CallbackProxyImpl.setEventTableStringColumn(CallbackProxyImpl.java:197)
at com.yourkit.probes.StringColumn.setValue(StringColumn.java:17)
at com.yourkit.probes.ResourceTable.setResourceName(ResourceTable.java:70)
at com.yourkit.probes.builtin.Threads$Thread_setName_Probe.onReturn(Threads.java:199)
at java.lang.Thread.setName(Thread.java:1133)
- locked <0x00000006827db478> (a io.netty.util.concurrent.FastThreadLocalThread)
at kotlinx.coroutines.CoroutineId.restoreThreadContext(CoroutineContext.kt:83)
at kotlinx.coroutines.CoroutineId.restoreThreadContext(CoroutineContext.kt:60)
at kotlinx.coroutines.internal.ThreadContextKt.restoreThreadContext(ThreadContext.kt:95)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:200)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:154)
at kotlinx.coroutines.future.FutureKt.future(Future.kt:44)
at kotlinx.coroutines.future.FutureKt.future$default(Future.kt:36)
So we're certainly not positive but it sure seems like kotlinx.coroutines.debug has non-negligable performance impact when combined with YourKit.Paul Woitaschek
09/09/2019, 10:12 AMDico
09/09/2019, 3:55 PMsdeleuze
09/10/2019, 1:34 PMrocketraman
09/10/2019, 4:41 PMrocketraman
09/10/2019, 6:03 PMSergio C.
09/10/2019, 7:39 PMvngantk
09/11/2019, 9:03 AMStanislav Shamilov
09/12/2019, 9:51 PMfun EditText.textChanges(): Flow<String> = callbackFlow {
val textWatcher = textWatcher(afterText = {
this.channel.offer(it ?: "")
})
this@textChanges.addTextChangedListener(textWatcher)
awaitClose { this@textChanges.removeTextChangedListener(textWatcher) }
}
private fun textWatcher(
beforeText: (String?) -> Unit = {},
onText: (String?) -> Unit = {},
afterText: (String?) -> Unit = {}
): TextWatcher {
return object : TextWatcher {
override fun afterTextChanged(s: Editable?) = afterText(s?.toString())
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = beforeText(s?.toString())
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) = onText(s?.toString())
}
}
Kotlin version: 1.3.50
Coroutines version: 1.3.0
IDE: Android Studio 3.5
I have two questions:
1. Why does this warning show up?
2. What does this warning stand for?
Thanks in advance!myanmarking
09/13/2019, 12:45 PMadvanceTimeBy
louiscad
09/14/2019, 5:15 PMCall<Void?>
(without suspend modifier) with the await
suspending extension.