Our great sponsors
-
I have a program in go that will open a new connection for each request. with a massive concurrent requests, redis goes down. I though why not i create a concurrent safe singleton pattern like this https://play.golang.org/p/BYxuXN16HlV. Do you think this approach is good or do u have a different approach. I know in mysql drive they handle the maximum number of open connections but it doesn't seem that's the case for this Redis package https://github.com/go-redis/redis
-
IMO you should avoid package level state and use dependency injection to pass the DB reference to your HTTP handlers. I found an example here https://github.com/sohamkamani/go-dependency-injection-example
-
SonarLint
Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.