test: grpc add timeout

pull/458/head
Gordon 2 years ago
parent 60afea092b
commit 68db27330b

@ -2,6 +2,7 @@ package api
import ( import (
"context" "context"
"time"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
@ -17,7 +18,7 @@ import (
) )
func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.UniversalClient) *gin.Engine { func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.UniversalClient) *gin.Engine {
discov.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials())) // 默认RPC中间件 discov.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithTimeout(time.Second*3)) // 默认RPC中间件
gin.SetMode(gin.ReleaseMode) gin.SetMode(gin.ReleaseMode)
//f, _ := os.Create("../logs/api.log") //f, _ := os.Create("../logs/api.log")
//gin.DefaultWriter = io.MultiWriter(f) //gin.DefaultWriter = io.MultiWriter(f)

Loading…
Cancel
Save