| title: Timeouts and Deadlines |
| To abandon synchronous calls that run too long, use the select statement with time.After: |
| go func() { c <- client.Call("Service.Method", args, &reply) } () |
| case <-time.After(timeoutNanoseconds): |
| Note that the channel ` c ` has a buffer size of 1. If it were an unbuffered channel and the client.Call method took more than ` timeoutNanoseconds `, the channel send would block forever and the goroutine would never be destroyed. |
| time.After: https://pkg.go.dev/time/#After |
| select: https://go.dev/ref/spec#Select_statements |
| blog post: https://go.dev/blog/2010/09/go-concurrency-patterns-timing-out-and.html |