mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-07 16:47:24 +00:00
fix: Fix connect timeout
This commit is contained in:
parent
dfbc4cdf93
commit
344c44d126
1 changed files with 2 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AmqpConnectionPool struct {
|
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)
|
// 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 {
|
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)
|
connection, err := p.internalNewConnection(ctx)
|
||||||
cancelFn()
|
cancelFn()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue