This commit is contained in:
DeniskaRediska committed 2019-10-24 16:31:08 +03:00
1 parent 4fdf7c0ca2
commit 5b115440f1
12 files changed
+115 -89

No files matched your search

+2 -2
View File
@@ -42,7 +42,7 @@ var (
func convertError(err error) ([]byte, int) {
s, ok := status.FromError(err)
if ok {
cfg := config.GetRemote().(*conf.RemoteConfig)
cfg := config.GetRemote().(*conf.RemoteConfig).GrpcSetting
if cfg.EnableOriginalProtoErrors {
if body, err := proto.Marshal(s.Proto()); err != nil {
return []byte(utils.ServiceError), http.StatusServiceUnavailable
@@ -105,7 +105,7 @@ func logHandlerError(typeData, method string, err error) {
log.WithMetadata(map[string]interface{}{
log_code.MdTypeData: typeData,
log_code.MdMethod: method,
}).Warn(log_code.WarnRequestHandler, err)
}).Warn(log_code.WarnProxyGrpcHandler, err)
}
func openStream(headers *fasthttp.RequestHeader, method string, timeout time.Duration, client *backend.RxGrpcClient) (
+2 -2
View File
@@ -22,7 +22,7 @@ var getFile getFileDesc
type getFileDesc struct{}
func (g getFileDesc) Complete(ctx *fasthttp.RequestCtx, method string, client *backend.RxGrpcClient) {
cfg := config.GetRemote().(*conf.RemoteConfig)
cfg := config.GetRemote().(*conf.RemoteConfig).GrpcSetting
timeout := cfg.GetStreamInvokeTimeout()
req, err := g.readJsonBody(ctx)
@@ -96,7 +96,7 @@ func (g getFileDesc) Complete(ctx *fasthttp.RequestCtx, method string, client *b
log.WithMetadata(map[string]interface{}{
log_code.MdTypeData: log_code.TypeData.GetFile,
log_code.MdMethod: method,
}).Errorf(log_code.WarnRequestHandler, "Method %s. Expected bytes array", method)
}).Errorf(log_code.WarnProxyGrpcHandler, "Method %s. Expected bytes array", method)
break
}
_, err = ctx.Write(bytes)
+1 -1
View File
@@ -33,7 +33,7 @@ func (p handleJsonDesc) Complete(c *fasthttp.RequestCtx, method string, client *
md, methodName := makeMetadata(&c.Request.Header, method)
ctx := metadata.NewOutgoingContext(context.Background(), md)
cfg := config.GetRemote().(*conf.RemoteConfig)
ctx, cancel := context.WithTimeout(ctx, cfg.GetSyncInvokeTimeout())
ctx, cancel := context.WithTimeout(ctx, cfg.GrpcSetting.GetSyncInvokeTimeout())
defer cancel()
cli, err := client.Conn()
@@ -19,7 +19,7 @@ var sendMultipartData sendMultipartDataDesc
type sendMultipartDataDesc struct{}
func (h sendMultipartDataDesc) Complete(ctx *fasthttp.RequestCtx, method string, client *backend.RxGrpcClient) {
cfg := config.GetRemote().(*conf.RemoteConfig)
cfg := config.GetRemote().(*conf.RemoteConfig).GrpcSetting
timeout := cfg.GetStreamInvokeTimeout()
bufferSize := cfg.GetTransferFileBufferSize()