|
@@ -1,12 +1,17 @@
|
|
|
package ossClient
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/api"
|
|
|
"bytes"
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
"google.golang.org/grpc"
|
|
|
+ "google.golang.org/grpc/keepalive"
|
|
|
"io"
|
|
|
+ "jygit.jydev.jianyu360.cn/BaseService/ossClient/constant"
|
|
|
+ "jygit.jydev.jianyu360.cn/BaseService/ossClient/entity"
|
|
|
+ "jygit.jydev.jianyu360.cn/BaseService/ossClient/pb"
|
|
|
"log"
|
|
|
"mime/multipart"
|
|
|
"net/http"
|
|
@@ -14,11 +19,6 @@ import (
|
|
|
"strconv"
|
|
|
"sync"
|
|
|
"time"
|
|
|
-
|
|
|
- "app.yhyue.com/moapp/jybase/api"
|
|
|
- "jygit.jydev.jianyu360.cn/BaseService/ossClient/constant"
|
|
|
- "jygit.jydev.jianyu360.cn/BaseService/ossClient/entity"
|
|
|
- "jygit.jydev.jianyu360.cn/BaseService/ossClient/pb"
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -249,7 +249,11 @@ func RpcCall(address, serviceMethod string, args any, reply any) error {
|
|
|
func GrpcCall(address string, timeout int64) (pb.ServiceClient, context.Context, func(), error) {
|
|
|
var err error
|
|
|
GrpcCoonOnce.Do(func() {
|
|
|
- GrpcCoon, err = grpc.Dial(address, grpc.WithInsecure())
|
|
|
+ GrpcCoon, err = grpc.Dial(address, grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
|
|
+ Time: 10 * time.Second, // 发送ping的间隔
|
|
|
+ Timeout: 5 * time.Second, // 等待pong响应的超时时间
|
|
|
+ PermitWithoutStream: true, // 是否在没有活跃流的情况下发送pings
|
|
|
+ }))
|
|
|
})
|
|
|
var cancel context.CancelFunc
|
|
|
if err != nil {
|