Add timeout for upstream connection registration
This commit is contained in:
parent
77460dfb97
commit
9fb789ee26
3
user.go
3
user.go
@ -191,6 +191,9 @@ func (net *network) runConn(ctx context.Context) error {
|
|||||||
net.user.srv.metrics.upstreams.Add(1)
|
net.user.srv.metrics.upstreams.Add(1)
|
||||||
defer net.user.srv.metrics.upstreams.Add(-1)
|
defer net.user.srv.metrics.upstreams.Add(-1)
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, time.Minute)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
uc, err := connectToUpstream(ctx, net)
|
uc, err := connectToUpstream(ctx, net)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to connect: %w", err)
|
return fmt.Errorf("failed to connect: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user