On Monday, April 18, 2022 at 6:17:30 PM UTC+10 toon....@gmail.com wrote:
> I did experiment but when using the same client I immediately got an EOF > again. But that might also have been due to the rate-limiting. That's interesting. Could you try printing the response status or writing client middleware to further poke into the internals? > > I started reading the source code of the http.Client and DefaultTransport > but if any could advice good articles/books about the internals to get the > most out of it, I would be very interested. > You can search online for "Go roundtripper" and use them for some experimentation. My book talks about the transport and connection pooling. Some free preview available: https://books.google.com.au/books?id=T5FNEAAAQBAJ&lpg=PT115&pg=PT137#v=onepage&q&f=false > On Monday, April 18, 2022 at 6:23:22 AM UTC+2 amits...@gmail.com wrote: > >> On Sunday, April 17, 2022 at 11:52:17 PM UTC+10 toon....@gmail.com wrote: >> >>> It is not clear to me from the documentation whether I can continue to >>> use an http.Client after a POST failed (due to the connection being closed >>> ; In my case the connection closes probably due to rate-limiting). >>> >>> The documentation of the http.Transport does mention that, if a network >>> error occurs, it will retry if the request is idempotent. Given I'm doing a >>> basicPOST that is not the case for me. >>> >>> But the http.Client will reestablish the connection on the next call to >>> Post(...) ? >>> >> >> I believe you will see that's the case. Perhaps worth experimenting with >> it? The reason is due to the underlying connection pooling behavior of the >> DefaultTransport: https://go.dev/src/net/http/transport.go#L42: >> " It establishes network connections as needed // and caches them for >> reuse by subsequent calls" >> >> >>> toon >>> >>> >>> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/9af66140-e9c0-4eaa-9e5f-99b05f01d42fn%40googlegroups.com.