[kotlin][client] define kotlin coroutines context#9936
[kotlin][client] define kotlin coroutines context#9936wing328 merged 4 commits intoOpenAPITools:masterfrom
Conversation
|
@4brunu Any reason why you choose Just ran into an issue where my existing Context is not getting passed down which causes various issues for me. |
|
@richardklint Yes, I choose withContext(Dispatchers.IO) to make sure that the work done inside this method is not performed in the main thread. Can you elaborate a bit more on the problem you are having and create a sample project to show the issue? |
|
@4brunu Perhaps this is just my inexperience with coroutines but my app is using coroutines internally to call multiple apis at the same time in a non blocking way and I've added https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration/kotlinx-coroutines-slf4j in order to preserve context across the children for logging purposes. However when entering one of these functions, it loses all context due to it not inherenting the previous context like |
|
Hi @richardklint, your use case seams like an advanced one and honestly I don't know the answer to it. |
Initially when kotlin coroutines support was introduced in #6362, there was no coroutines context defined, this PR fixes that.
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master,5.3.x,6.0.x@jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11)