Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Introduction to Coroutines and Channels: Using Suspend Functions Inaccuracy #153

Open
doridori opened this issue Sep 10, 2021 · 0 comments

Comments

@doridori
Copy link

Hey,

Reading https://play.kotlinlang.org/hands-on/Introduction%20to%20Coroutines%20and%20Channels/04_Suspend I have noticed an inaccuracy.

We have the below:

Screenshot 2021-09-10 at 13 48 44

This description is misleading, as the requests are not actually "taking place" | "being sent" on the UI thread at all. The requests are being initiated from and responses processed by the main thread but retrofit under the hood is enqueing them, which will result in them actually being run on a worker Thread. The log in the screenshot is logging the thead the response is processed on after the worker thread has finished.

It sounds pendantic but as this is a course on concurrency at present it's a little misleading. I can submit a PR to re-word this if desired.

Here is a call to the internal enqueue for reference https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/KotlinExtensions.kt#L36

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant