The /sleep-6s handler is called twice if set server.WriteTimeout to 3s and 
handler cost 6s.
And if don't call "get-1" handler, the "sleep-6s" handler will not be 
called twice, why is that happen?

server code:
https://play.golang.org/p/DngpDOfb05W

client code:
https://play.golang.org/p/jNQHIurac7_A

run server then run client in local,

client output:
2019/03/11 10:37:11 get-1 resp status code: 200
2019/03/11 10:37:11 get-1 resp body: get-1
2019/03/11 10:37:23 sleep-6s err: Get http://127.0.0.1:9000/sleep-6s: EOF

server output:
2019/03/11 10:37:03 Server listening at 127.0.0.1:9000 ...

2019/03/11 10:37:11 >>> enter /get-1 handler
2019/03/11 10:37:11 <<< leave /get-1 handler

2019/03/11 10:37:11 >>> enter /sleep-6s handler
2019/03/11 10:37:11 >>> before sleep
2019/03/11 10:37:17 >>> after sleep
2019/03/11 10:37:17 >>> written and err: 8 <nil>
2019/03/11 10:37:17 <<< leave /sleep-6s handler

2019/03/11 10:37:17 >>> enter /sleep-6s handler
2019/03/11 10:37:17 >>> before sleep
2019/03/11 10:37:23 >>> after sleep
2019/03/11 10:37:23 >>> written and err: 8 <nil>
2019/03/11 10:37:23 <<< leave /sleep-6s handler

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to