looking at the docs for <https://kotlin.github.io/...
# coroutines
n
looking at the docs for https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.future/await.html can some one explain what does “one-shot future” mean in this context. It’s not clear to me when one should use
.await()
vs
.asDeffered().await()
.
n
It means you started the future for use in a single spot like
startFuture().await().
If this await is cancelled, nothing else will use the future so it's safe to cancel. Use
asDeferred().await()
if the future is stored and used elsewhere or if it causes side effects that you still want even if the awaiting coroutine is cancelled.