mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
fix: ssh tunnel检测导致死锁问题调整
This commit is contained in:
@@ -25,7 +25,7 @@ func init() {
|
||||
if v.Stats().TotalConns == 0 {
|
||||
continue // 连接池中没有连接,跳过
|
||||
}
|
||||
conn, err := v.Get(context.Background())
|
||||
conn, err := v.Get(context.Background(), pool.WithNoUpdateLastActive())
|
||||
if err != nil {
|
||||
continue // 获取连接失败,跳过
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func init() {
|
||||
if v.Stats().TotalConns == 0 {
|
||||
continue // 连接池中没有连接,跳过
|
||||
}
|
||||
conn, err := v.Get(context.Background())
|
||||
conn, err := v.Get(context.Background(), pool.WithNoUpdateLastActive())
|
||||
if err != nil {
|
||||
continue // 获取连接失败,跳过
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package mcm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"mayfly-go/pkg/pool"
|
||||
)
|
||||
|
||||
@@ -51,11 +52,11 @@ func GetMachineCli(ctx context.Context, authCertName string, getMachine func(str
|
||||
|
||||
// 删除指定机器缓存客户端,并关闭客户端连接
|
||||
func DeleteCli(id uint64) {
|
||||
for _, pool := range poolGroup.AllPool() {
|
||||
if pool.Stats().TotalConns == 0 {
|
||||
for _, p := range poolGroup.AllPool() {
|
||||
if p.Stats().TotalConns == 0 {
|
||||
continue
|
||||
}
|
||||
conn, err := pool.Get(context.Background())
|
||||
conn, err := p.Get(context.Background(), pool.WithNoUpdateLastActive())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
@@ -63,4 +64,6 @@ func DeleteCli(id uint64) {
|
||||
poolGroup.Close(conn.Info.AuthCertName)
|
||||
}
|
||||
}
|
||||
// 删除隧道
|
||||
tunnelPoolGroup.Close(fmt.Sprintf("machine-tunnel-%d", id))
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ func init() {
|
||||
if v.Stats().TotalConns == 0 {
|
||||
continue // 连接池中没有连接,跳过
|
||||
}
|
||||
conn, err := v.Get(context.Background())
|
||||
conn, err := v.Get(context.Background(), pool.WithNoUpdateLastActive())
|
||||
if err != nil {
|
||||
continue // 获取连接失败,跳过
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func init() {
|
||||
if v.Stats().TotalConns == 0 {
|
||||
continue // 连接池中没有连接,跳过
|
||||
}
|
||||
rc, err := v.Get(context.Background())
|
||||
rc, err := v.Get(context.Background(), pool.WithNoUpdateLastActive())
|
||||
if err != nil {
|
||||
continue // 获取连接失败,跳过
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user