server: sleep for a while after reaching the concurrency limit, so other concurrently running servers could accept and process incoming connections

This commit is contained in:
Aliaksandr Valialkin
2016-03-29 12:00:21 +03:00
parent dbea792cf7
commit 169b5eac74
+8
View File
@@ -1188,6 +1188,14 @@ func (s *Server) Serve(ln net.Listener) error {
"Try increasing Server.Concurrency", maxWorkersCount)
lastOverflowErrorTime = time.Now()
}
// The current server reached concurrency limit,
// so give other concurrently running servers a chance
// accepting incoming connections on the same address.
//
// There is a hope other servers didn't reach their
// concurrency limits yet :)
time.Sleep(100 * time.Millisecond)
}
c = nil
}