You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/vision/shiny_future/barbara_makes_a_wish.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Barbara, always prepared, has already added logging to her service and she check
18
18
19
19
She checks the code and sees that the endpoint spawns several tasks, but unfortunately those tasks don't have much logging in them.
20
20
21
-
Barbara now remembers hearing something about an`wish4-async-insight` crate, which has gotten some buzz on her Rust-related social media channels. She decides to give that a shot.
21
+
Barbara now remembers hearing something about a`wish4-async-insight` crate, which has gotten some buzz on her Rust-related social media channels. She decides to give that a shot.
22
22
23
23
She adds the crate as a dependency to her `Cargo.toml`, renaming it to just `insight` to make it easier to reference in her code, and then initializes it in her main async function.
Barbara rebuilds and run her program again. She doesn't see anything different in the terminal output for the program itself though, and the behavior is the same as before: hitting an endpoint, nothing happens. She double-checks the readme for the `async-executor-insight` crate, and realizes that she needs to connect other programs to her service to observe the insights being gathered. Barbara decides that she wants to customize the port that `insight` is listening on before she starts her experiments with those programs.
32
+
Barbara rebuilds and runs her program again. She doesn't see anything different in the terminal output for the program itself though, and the behavior is the same as before: hitting an endpoint, nothing happens. She double-checks the readme for the `async-executor-insight` crate, and realizes that she needs to connect other programs to her service to observe the insights being gathered. Barbara decides that she wants to customize the port that `insight` is listening on before she starts her experiments with those programs.
@@ -50,11 +50,11 @@ One such program, `consolation`, can run in the terminal. Barbara is currently j
50
50
51
51
This brings up a terminal window that looks similar to the Unix `top` program, except that instead of a list of OS processes, this offers a list of tasks, with each task having a type, ID, and status history (i.e. percentage of time spent in running, ready to poll, or blocked). Barbara skims the output in the list, and sees that one task is listed as currently blocked.
52
52
53
-
Barbara taps the arrow-keys and sees that this causes a cursor to highlight different tasks in the list. She highlights the blocked task and hits the Enter key. This cause the terminal to switch to a Task view, describing more details about that task and its status.
53
+
Barbara taps the arrow-keys and sees that this causes a cursor to highlight different tasks in the list. She highlights the blocked task and hits the Enter key. This causes the terminal to switch to a Task view, describing more details about that task and its status.
54
54
55
55
The Task view here says that the task is blocked, references a file and line number, and also includes the line from the source code, which says `chan.send(value).await`. The blocked task also lists the resources that the task is waiting on: `prototype_channel`, and next to that there is text on a dark red background: "waiting on channel capacity." Again, Barbara taps the arrow-keys and sees that she can select the line for the resource.
56
56
57
-
Barbara notices that this whole time, at the bottom of the terminal, there was a line that says "For help, hit `?` key"; she taps question mark. This brings up a help message in a scrollable subwindow explaining the task view in general, sa well as link to online documentation. The help message notes that the user can follow the chain: One can go from the blocked task to the resource its waiting on, and from that resource to a list of tasks responsible for freeing up the resource.
57
+
Barbara notices that this whole time, at the bottom of the terminal, there was a line that says "For help, hit `?` key"; she taps question mark. This brings up a help message in a scrollable subwindow explaining the task view in general as well as link to online documentation. The help message notes that the user can follow the chain: One can go from the blocked task to the resource it's waiting on, and from that resource to a list of tasks responsible for freeing up the resource.
58
58
59
59
Barbara hits the Escape key to close the help window. The highlight is still on the line that says "prototype_channel: waiting on channel capacity"; Barbara hits Enter, and this brings up a list with just one task on it: The channel reader task. Barbara realizes what this is saying: The channel resource is blocking the sender because it is full, and the only way that can be resolved is if the channel reader manages to receive some inputs from the channel.
60
60
@@ -93,7 +93,7 @@ Barbara hits `D` and stares at the resulting graph.
93
93
94
94
Barbara suddenly realizes her mistake: She had constructed a single task that was sometimes enqueuing work (by sending messages on the channel), and sometimes dequeuing work, but she had not put any controls into place to ensure that the dequeuing (via `recv`) would get prioritized as the channel filled up.
95
95
96
-
Barbara reflects on the matter: she knows that she could swap in an unbounded channel to resolve this, but she think that she would be better off thinking a bit more about her system design, to see if she can figure out a way to supply back-pressure so that the send rate will go down as the channel fills up.
96
+
Barbara reflects on the matter: she knows that she could swap in an unbounded channel to resolve this, but she thinks that she would be better off thinking a bit more about her system design, to see if she can figure out a way to supply back-pressure so that the send rate will go down as the channel fills up.
97
97
98
98
99
99
## 🤔 Frequently Asked Questions
@@ -163,4 +163,4 @@ At the very least, as mentioned among the "incremental steps", we will need a co
163
163
[htvsf]: ../how_to_vision/shiny_future.md
164
164
[projects]: ../projects.md
165
165
[cannot be wrong]: ../how_to_vision/comment.md#comment-to-understand-or-improve-not-to-negate-or-dissuade
0 commit comments