Skip to content

Commit 13b1370

Browse files
committed
chore: minor fixes
1 parent 7c3ac42 commit 13b1370

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/topics/coroutines-and-channels.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ This API is used by the `loadContributorsBlocking()` function to fetch the list
118118
* When you get the response, the result is logged by calling the specific `logRepos()` and `logUsers()` functions (`#3`).
119119
If the HTTP response contains an error, this error will be logged here.
120120
* Finally, get the response's body, which contains the data you need. For this tutorial, you'll use an empty list as a
121-
result in case there is an error, and youll log the corresponding error (`#4`).
121+
result in case there is an error, and you'll log the corresponding error (`#4`).
122122
123123
2. To avoid repeating `.body() ?: emptyList()`, an extension function `bodyList()` is declared:
124124
@@ -281,7 +281,7 @@ Make sure to call the logic passed in the callback explicitly. Otherwise, nothin
281281

282282
### Use the Retrofit callback API
283283

284-
In the previous solution, the whole loading logic is moved to the background thread, but that still isnt the best use of
284+
In the previous solution, the whole loading logic is moved to the background thread, but that still isn't the best use of
285285
resources. All of the loading requests go sequentially and the thread is blocked while waiting for the loading result,
286286
while it could have been occupied by other tasks. Specifically, the thread could start loading another request to
287287
receive the entire result earlier.
@@ -367,7 +367,7 @@ However, this code also fails to achieve our objective. Try to find the answer y
367367

368368
#### The second attempted solution for task 3 {initial-collapse-state="collapsed"}
369369

370-
Since the loading requests are started concurrently, theres no guarantee that the result for the last one comes last. The
370+
Since the loading requests are started concurrently, there's no guarantee that the result for the last one comes last. The
371371
results can come in any order.
372372
373373
Thus, if you compare the current index with the `lastIndex` as a condition for completion, you risk losing the results for
@@ -583,7 +583,7 @@ despite all the requests taking place on the main UI thread:
583583
modify the template for running all of the Kotlin files and enable this option by default.
584584
585585
Now all of the code runs on one coroutine, the "load contributors" coroutine mentioned above, denoted as `@coroutine#1`.
586-
While waiting for the result, you shouldnt reuse the thread for sending other requests because the code is
586+
While waiting for the result, you shouldn't reuse the thread for sending other requests because the code is
587587
written sequentially. The new request is sent only when the previous result is received.
588588

589589
Suspending functions treat the thread fairly and don't block it for "waiting". However, this doesn't yet bring any concurrency
@@ -725,7 +725,7 @@ create as many as you need.
725725
```
726726
727727
2. Run the code and check the log. All of the coroutines still run on the main UI thread because
728-
multithreading hasnt been employed yet, but you can already see the benefits of running coroutines concurrently.
728+
multithreading hasn't been employed yet, but you can already see the benefits of running coroutines concurrently.
729729
3. To change this code to run "contributors" coroutines on different threads from the common thread pool,
730730
specify `Dispatchers.Default` as the context argument for the `async` function:
731731

@@ -1347,7 +1347,7 @@ they make life easier when you need to understand what's going on.
13471347

13481348
## Testing coroutines
13491349

1350-
Lets now test all solutions to check that the solution with concurrent coroutines is faster than the solution with
1350+
Let's now test all solutions to check that the solution with concurrent coroutines is faster than the solution with
13511351
the `suspend` functions, and check that the solution with channels is faster than the simple "progress" one.
13521352
13531353
In the following task, you'll compare the total running time of the solutions. You'll mock a GitHub service and make

0 commit comments

Comments
 (0)