重构:文件系统模块化架构,优化应用启动流程
This commit is contained in:
@@ -5,8 +5,8 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"go-desk/internal/common"
|
||||
"go-desk/internal/crypto"
|
||||
"go-desk/internal/storage/models"
|
||||
)
|
||||
@@ -84,7 +84,7 @@ func (p *ConnectionPool) GetRedisClient(conn *models.DbConnection) (*RedisClient
|
||||
// 检查是否已存在
|
||||
if client, ok := p.redisClients[conn.ID]; ok {
|
||||
// 测试连接是否有效
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), common.TimeoutPing)
|
||||
defer cancel()
|
||||
if err := client.client.Ping(ctx).Err(); err == nil {
|
||||
return client, nil
|
||||
@@ -140,7 +140,7 @@ func (p *ConnectionPool) GetMongoClient(conn *models.DbConnection) (*MongoClient
|
||||
// 检查是否已存在
|
||||
if client, ok := p.mongoClients[conn.ID]; ok {
|
||||
// 测试连接是否有效
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), common.TimeoutPing)
|
||||
defer cancel()
|
||||
if err := client.client.Ping(ctx, nil); err == nil {
|
||||
return client, nil
|
||||
|
||||
Reference in New Issue
Block a user