Skip to content

Commit ab9e23c

Browse files
committed
added image descriptions
1 parent 4c0177c commit ab9e23c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ if __name__ == "__main__":
115115

116116
If the HTTP request takes 60 seconds, the program idles for those 60 seconds before executing the next line. For a single request this is fine, but it becomes a bottleneck when you need to fetch data for many symbols or endpoints.
117117

118-
![synchronous](images/02_synchronous_simple.png)
118+
![synchronous operation diagram](images/02_synchronous_simple.png)
119119

120120
On the other hand, **Asynchronous** code allows multiple tasks to run concurrently in a non-blocking manner. While one task is waiting for I/O (such as a network response), the event loop can hand control to another task (execute next line of codes) instead of sitting idle. The example below uses `asyncio.create_task()` method to launch a fetch in the background and immediately continues to the next line — without waiting for the response:
121121

@@ -142,7 +142,7 @@ if __name__ == "__main__":
142142

143143
![asynchronous code result](images/03_httpx_async.png)
144144

145-
![asynchronous](images/04_asynchronous_simple.png)
145+
![asynchronous operation diagram](images/04_asynchronous_simple.png)
146146

147147
The real payoff of async comes when you have **many requests to make**. With `asyncio.gather()`, you can fire all of them concurrently so the total wall-clock time is roughly that of the single slowest response — instead of the sum of all response times. That is exactly the pattern used in `example_async_gather.py` and `async_call_nb.ipynb` examples for fetching multiple RICs.
148148

0 commit comments

Comments
 (0)