Re: [go-nuts] net/http: question about RoundTripper

2020-05-15 Thread Anuj Agrawal
ing anything other than the http.RoundTripper a > practical impossibility. > > Personally, I've been using http.RoundTripper middleware for several years > without issue. It's a solid pattern that can provide an enormous amount of > value by allowing re-usable layers of behavior that can

[go-nuts] net/http: question about RoundTripper

2020-05-11 Thread Anuj Agrawal
I am trying to understand in what cases would it make sense to implement my own RoundTripper. If I search about it, I come across examples of RoundTripper that try to do things like caching, retries, authentication, etc. I also read somewhere that there are many RoundTripper implementations that

[go-nuts] http middleware and request context

2020-04-28 Thread Anuj Agrawal
Hi, I have a situation where I have a chain of middlewares with a logger middleware that comes before an authentication middleware. Logger middleware logs about the incoming request, calls the next middleware in the chain and then logs about the response. Authentication middleware authenticates

Re: [go-nuts] Re: avoiding os thread creation due to logging

2018-08-06 Thread Anuj Agrawal
number of goroutines trying > to concurrently write to the log file. This remove the need for the > buffering scheme. > > > On Sunday, August 5, 2018 at 9:32:06 AM UTC-7, Anuj Agrawal wrote: >> >> I have an application with more than 50k goroutines. I pass a context to

Re: [go-nuts] Re: How to reuse go fix tool code

2018-08-05 Thread Anuj Agrawal
nal parameter is variadic, as this > allows legal calls both with and without the argument. Then use eg to > remove the final argument from all callers, and remove the variadic > parameter by hand. The reverse process can be used to add a final > parameter. > > To add or remove parame

[go-nuts] avoiding os thread creation due to logging

2018-08-05 Thread Anuj Agrawal
I have an application with more than 50k goroutines. I pass a context to each of these goroutines which contains a logger and that logger writes to a file. At some point, the number of goroutines trying to write a log peaked and my application crashed with - runtime: program exceeds 1-thread

[go-nuts] How to reuse go fix tool code

2018-03-15 Thread Anuj Agrawal
in this code. That leaves me with only one choice - that I copy the code and then write the plugin on top of it. That does not sound like a very great idea as compared to being able to import the package itself. Is there any particular reason for not exporting any symbols in the gofix code? Thanks, Anuj

[go-nuts] Re: [mysql] 2017/12/23 11:09:37 packets.go:141: write tcp 127.0.0.1:20630->127.0.0.1:3306: write: broken pipe

2017-12-27 Thread Anuj Agrawal
I am seeing similar logs even after I add db.SetConnMaxLifetime(10 * time.Second). Test code here: https://play.golang.org/p/itTUXDYv4Ge Any suggestions on how to debug further? On Monday, December 25, 2017 at 12:10:02 PM UTC+5:30, Naoki INADA wrote: > > >> >> To prevent further errors set