by seanalltogether · 2y ago · 0 comments
fun doLongRunning(): Single<Result> {
return Single.create { emitter ->
val longProcess = /* whatever */
emitter.onSuccess(longProcess_result)
emitter.setCancellable {
cleanup(longProcess)
}
}
}
doLongRunning()
.timeout(5_secs)
.subscribe({ result ->
}, { error ->
})