Skip to content

Tutorial text edit suggestion on GlobalScope #33

Open
@DefaultXYZ

Description

@DefaultXYZ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions