Skip to content
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

Tutorial text edit suggestion on GlobalScope #33

Open
DefaultXYZ opened this issue Dec 10, 2022 · 1 comment
Open

Tutorial text edit suggestion on GlobalScope #33

DefaultXYZ opened this issue Dec 10, 2022 · 1 comment

Comments

@DefaultXYZ
Copy link

Hello 😃

In part of tutorial "Canceling the loading of contributors" on step 3 it is suggested to add 3-second delay.

And the actual code sample stands like that:

suspend fun loadContributorsConcurrent(
    service: GitHubService,
    req: RequestData
): List<User> = coroutineScope {
    // ...
    GlobalScope.async {
        log("starting loading for ${repo.name}")
        delay(3000)
        // load repo contributors
    }
    // ...
}

I guess, it shouldn't be GlobalScope.async {} in this case. Therefore, if we will add GlobalScope, then loading won't be canceled.

@aysegulatwork
Copy link

Just came here to point out same thing :)

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

No branches or pull requests

2 participants