Fixed
Status Update
Comments
ra...@google.com <ra...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
ra...@google.com <ra...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
an...@google.com <an...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
Description
Version used: 2.3.2 stable
Devices/Android versions reproduced on: Samsung Galaxy S10e API 28, PIxel XL Emulator API 26
Sample project:
After enqueueing ForegroundWorker with OneTimeWorkRequest that should take 12 minutes and waiting 10 minutes I have observed that the new worker is spawned while the old one is still running. I tried a few approaches: updating service notification with notification manager and with setForeground, coroutine and Rx worker. And I'm still encountering this weird behaviour.
In a next few days I will try to track Workers timers to debug this issue but I have a limited knowledge about