-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explore coroutine-based API #501
Comments
@swankjesse started a proof-of-concept using NIO's async API in #531, and there's a ton of discussion there. That proposal adds non-blocking variants to only the basic read/write APIs - processing data using |
Not sure where this exploration is currently at, but I've been exploring a coroutine-based API as well in a personal repository. |
The okhttp `Call` class supports cancellation. Rather than `execute()` it inline, we use the `await()` helper from `ru.gildor.coroutines:kotlin-coroutines-okhttp` to ensure that cancellation of the coroutine scope managed by WorkManager correctly cancels any inflight Call. Note that we can't do the same for the call to `string()` as that is a blocking call and okio does not have a non-blocking version as per [this issue](square/okio#501). Fixes #722
The okhttp `Call` class supports cancellation. Rather than `execute()` it inline, we use the `await()` helper from `ru.gildor.coroutines:kotlin-coroutines-okhttp` to ensure that cancellation of the coroutine scope managed by WorkManager correctly cancels any inflight Call. Note that we can't do the same for the call to `string()` as that is a blocking call and okio does not have a non-blocking version as per [this issue](square/okio#501). Fixes #722
No plans. |
Coroutines will graduate to stable in Kotlin 1.3, which is currently in pre-release stages. We need a design doc on how Okio will be using coroutines and start sketching out the API.
The text was updated successfully, but these errors were encountered: