Grokking Concurrency in Go
Vote

0% completed

​

Cancellation Causes and AfterFunc

The program below cancels two searches for two very different reasons. The first is canceled because the client closed its connection. The second is canceled because one of its pages failed to parse, which made the rest of the work pointless. A log line written for each search should say which one happened.

Output:

WithCancel: context canceled | context canceled WithCancelCause: context canceled | context canceled Cause: client closed the connection | page b could not be parsed

Err gives the same answer for both searches, and it must

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content