fix: Fix connect timeout

This commit is contained in:
Christian Schaible 2025-01-15 07:53:07 +01:00
parent dfbc4cdf93
commit 344c44d126

View file

@ -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 {