From 169b5eac74ba4a8a241b901f48e2a97edd55c85d Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 29 Mar 2016 12:00:21 +0300 Subject: [PATCH] server: sleep for a while after reaching the concurrency limit, so other concurrently running servers could accept and process incoming connections --- server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server.go b/server.go index 36aa00d..bd84b93 100644 --- a/server.go +++ b/server.go @@ -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 }