From 795f524df0c25dc1be2737aa51881444875c547f Mon Sep 17 00:00:00 2001 From: Patrick Taibel Date: Mon, 9 Oct 2023 17:07:26 +0200 Subject: [PATCH] Fix non existing clients getting stacked up in overload scenarios --- connection/connection_pool.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connection/connection_pool.go b/connection/connection_pool.go index b151489..faab4ee 100644 --- a/connection/connection_pool.go +++ b/connection/connection_pool.go @@ -26,6 +26,7 @@ package connection import ( + "errors" "rmux/graphite" "rmux/log" "strings" @@ -117,7 +118,8 @@ func (cp *ConnectionPool) GetConnection() (connection *Connection, err error) { } return connection, nil - // TODO: Maybe a while/timeout/graphiteping loop? + case <-time.After(1 * time.Second): + return nil, errors.New("timeout while waiting for a new connection") } }