Grokking Concurrency in Go
0% completed
Timeouts with Timers
The program prints no page. It ends with this report:
fatal error: all goroutines are asleep - deadlock! goroutine 1 [chan receive]: main.main()
Here the runtime detects the problem, because main and the fetching goroutine are the only goroutines and both are blocked. In a real server, other goroutines keep running, so the runtime reports nothing. The goroutine that waits for the stuck call stays blocked for as long as the process runs.
A program cannot make another service answer, but it can limit how long it waits for the answer. What follows shows how a `select
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%