Fixed
Status Update
Comments
sa...@saket.me <sa...@saket.me> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
sa...@saket.me <sa...@saket.me> #3
yea i'll take it.
se...@google.com <se...@google.com>
ap...@google.com <ap...@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.
se...@google.com <se...@google.com>
na...@google.com <na...@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
Component used: WorkManager Version used: 2.7.1 Devices/Android versions reproduced on: all
When Worker throws an exception, current default behavior is to log this exception to Logcat. There is no way to customize this behavior.
Some applications might want to have a different behavior. One example would be to use a custom logger, or upload an analytics event when such a case happens.
Today, Configuration class already provides a way to handle exception during initialization and during scheduling. This feature requests is to add a similar mechanism to handle exceptions from worker.