-
Notifications
You must be signed in to change notification settings - Fork 431
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
#246, #168: Add Kotlin Coroutines support #313
Conversation
Codecov Report
@@ Coverage Diff @@
## master #313 +/- ##
============================================
+ Coverage 77.21% 77.39% +0.18%
+ Complexity 193 190 -3
============================================
Files 32 32
Lines 904 898 -6
Branches 148 152 +4
============================================
- Hits 698 695 -3
+ Misses 131 122 -9
- Partials 75 81 +6
Continue to review full report at Codecov.
|
Do we want to allow the user to select in which coroutine pool it will make the network request? |
Do you mean wrapping the suspend function with fun main(args: Array<String>) = runBlocking {
val call = async(CommonPool) { "https://httpbin.org/ip".httpGet().awaitStringResult() }
val ipInJson = call.await()
println(ipInJson)
} |
Android has own coroutine context for UI too. |
Doesn't Fuel already run in it's own ExecutorService? We don't want to start the coroutine on another thread which in turn calls Fuel which passes the actual request onto another thread. |
@iNoles I've added a Espresso test to covers the Android use case you've mention. @raharrison The |
@lucasvalenteds First of all, thanks for this!! It has been a pretty long awaited feature. What do you think about relaxing them so that it can be modified? |
@kittinunf Your welcome. Thank you for the Fuel project! About your question, I can't see how to make this coroutines module more flexible. I'm also failing to understand what it means in terms of implementation. Could you provide a use case to clarify how the developer can modify the module to get a better usage experience? |
Can this get merged as it still presents a solution to using Fuel with coroutines, even if more enhancements are needed in the future? |
@lucasvalenteds would you be so generous applying the finishing touch? |
@kittinunf Sure. Tell me what you need. |
I think if you can resolve conflict then this is good to go. |
it looks like |
The version was removed from a bad merge.
You are right, @kittinunf. Sorry about that. I don't have the Android development environment right now, so I'll need a couple of hours to review the full code in case the CI fails again. |
* Migrate `compile` to `implementation` * Migrate `testCompile` to `testImplementation`
* Change timeout from 15000 to 30000 * Split problematic test into three small tests * Improve assertion related to exception of `awaitString()` method
Sure no rush, I plan to release new version with this PR so as soon as it is ready, I will make it. Thanks for this though. It has been long overdue. I think you deserve a lot of credit for your work here :) |
Let's merge this in. I will investigate from master. |
This pull requests adds some suspend functions to the Request class. They were added in a new module called
fuel-coroutines
and are intended to allows the developers to avoid callbacks while using asynchronous calls.