From 344c44d126c224b73b3fed4a357160e22caa2083 Mon Sep 17 00:00:00 2001 From: Christian Schaible Date: Wed, 15 Jan 2025 07:53:07 +0100 Subject: [PATCH] fix: Fix connect timeout --- audit/messaging/amqp_connection_pool.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audit/messaging/amqp_connection_pool.go b/audit/messaging/amqp_connection_pool.go index 2358f5a..5b17a97 100644 --- a/audit/messaging/amqp_connection_pool.go +++ b/audit/messaging/amqp_connection_pool.go @@ -6,6 +6,7 @@ import ( "fmt" "log/slog" "sync" + "time" ) type AmqpConnectionPool struct { @@ -122,7 +123,7 @@ func (p *AmqpConnectionPool) GetConnection(handle *ConnectionPoolHandle) (*AmqpC // check that accessing the pool only with a valid index (out of bounds should only occur on shutdown) if handle.connectionOffset < len(p.connections) && p.connections[handle.connectionOffset] == nil { - ctx, cancelFn := context.WithTimeout(context.Background(), connectionTimeoutSeconds) + ctx, cancelFn := context.WithTimeout(context.Background(), connectionTimeoutSeconds*time.Second) connection, err := p.internalNewConnection(ctx) cancelFn() if err != nil {