From bc2091784011882348a70159da31ad578ef6e7b3 Mon Sep 17 00:00:00 2001
From: Andrey Meshkov <am@adguard.com>
Date: Wed, 4 Nov 2020 13:41:40 +0300
Subject: [PATCH 1/2] Change the default for max_goroutines #2257

---
 internal/dnsforward/dnsforward.go | 3 ---
 internal/home/config.go           | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go
index cf39a5c0..eb0e421d 100644
--- a/internal/dnsforward/dnsforward.go
+++ b/internal/dnsforward/dnsforward.go
@@ -185,9 +185,6 @@ func (s *Server) Prepare(config *ServerConfig) error {
 				return fmt.Errorf("DNS: invalid custom blocking IP address specified")
 			}
 		}
-		if s.conf.MaxGoroutines == 0 {
-			s.conf.MaxGoroutines = 50
-		}
 	}
 
 	// Set default values in the case if nothing is configured
diff --git a/internal/home/config.go b/internal/home/config.go
index 4728c2e3..5499eb61 100644
--- a/internal/home/config.go
+++ b/internal/home/config.go
@@ -120,6 +120,7 @@ var config = configuration{
 			Ratelimit:          20,
 			RefuseAny:          true,
 			AllServers:         false,
+			MaxGoroutines:      100, // maximum concurrent queries
 		},
 		FilteringEnabled:           true, // whether or not use filter lists
 		FiltersUpdateIntervalHours: 24,

From 84ca2f58a8b4379a3ee6d0bd9f754be20a3ecaea Mon Sep 17 00:00:00 2001
From: Andrey Meshkov <am@adguard.com>
Date: Thu, 5 Nov 2020 13:26:13 +0300
Subject: [PATCH 2/2] Added a more detailed comment

---
 internal/home/config.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/internal/home/config.go b/internal/home/config.go
index 5499eb61..2f1e7da7 100644
--- a/internal/home/config.go
+++ b/internal/home/config.go
@@ -120,7 +120,12 @@ var config = configuration{
 			Ratelimit:          20,
 			RefuseAny:          true,
 			AllServers:         false,
-			MaxGoroutines:      100, // maximum concurrent queries
+
+			// set default maximum concurrent queries to 300
+			// we introduced a default limit due to this:
+			// https://github.com/AdguardTeam/AdGuardHome/issues/2015#issuecomment-674041912
+			// was later increased to 300 due to https://github.com/AdguardTeam/AdGuardHome/issues/2257
+			MaxGoroutines: 300,
 		},
 		FilteringEnabled:           true, // whether or not use filter lists
 		FiltersUpdateIntervalHours: 24,