firebase-kotlin-sdk: suspending function firestore#collection#add hangs
Every now and then - maybe about 10% of the times - the following code just hangs:
override fun createTask(title: String, callback: (SuccessFailure<Unit>) -> Unit) = MainScope().launch {
try {
val task = FireStoreTodoTask(
title = title
)
val path = "${list.path}/tasks"
logI(TAG, "On $path creating task $task")
firebaseStore.collection(path).add(task, FireStoreTodoTask.serializer())
logI(TAG, "Creating task succeeded")
callback.invoke(Success(Unit))
} catch (throwable: Throwable) {
logI(TAG, "Creating task failed", throwable)
callback.invoke(Failure(TAG, throwableReasonConverter.convert(throwable)))
}
}
After firebaseStore.collection(path).add(task, FireStoreTodoTask.serializer()) nothing happens. The suspend function just keeps running. Neither end I up in the next line nor I get thrown at.
Has anyone else been experiencing this?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (10 by maintainers)
.first { it.meetsCriteria }
So best way is to not use childEvents but valueEvents.first()
That’s true. The Flow docs need serious updating. There is a whole section called “Flows are cold” which is clearly wrong.