Skip to content

Commit

Permalink
Merge pull request #475 from anandrgitnirman/max_size
Browse files Browse the repository at this point in the history
#474 : We need to parametrize the max send and recv message for the passthrough endpoint point
  • Loading branch information
anandrgitnirman authored Mar 24, 2020
2 parents d18461e + 4d75d41 commit 99405c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ deploying SingularityNET services using SingularityNET Daemon should install the
$ go get -u github.com/golang/protobuf/protoc-gen-go
```

* install [grpc]
* install [grpc] `grpc version > 1.25`
```bash
$ go get -u google.golang.org/grpc
```
Expand Down Expand Up @@ -234,6 +234,7 @@ see [logger configuration](./logger/README.md)
The default value set is to 4 (units are in MB ), this is used to configure the max size in MB of the message received by the Daemon.
In case of Large messages , it is recommended to use streaming than setting a very high value on this configuration.
It is not recommended to set the value more than 4GB
`Please make sure your grpc version > 1.25`

* **metering_enabled** (optional,default: `false`) -
This is used to define if metering needs to be enabled or not .You will need to define a valid ` metering_end_point`
Expand Down
6 changes: 5 additions & 1 deletion handler/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var grpcDesc = &grpc.StreamDesc{ServerStreams: true, ClientStreams: true}

type grpcHandler struct {
grpcConn *grpc.ClientConn
options grpc.DialOption
enc string
passthroughEndpoint string
executable string
Expand All @@ -41,6 +42,9 @@ func NewGrpcHandler(serviceMetadata *blockchain.ServiceMetadata) grpc.StreamHand
enc: serviceMetadata.GetWireEncoding(),
passthroughEndpoint: config.GetString(config.PassthroughEndpointKey),
executable: config.GetString(config.ExecutablePathKey),
options: grpc.WithDefaultCallOptions(
grpc.MaxCallRecvMsgSize(config.GetInt(config.MaxMessageSizeInMB)*1024*1024),
grpc.MaxCallSendMsgSize(config.GetInt(config.MaxMessageSizeInMB)*1024*1024)),
}

switch serviceMetadata.GetServiceType() {
Expand All @@ -50,7 +54,7 @@ func NewGrpcHandler(serviceMetadata *blockchain.ServiceMetadata) grpc.StreamHand
log.WithError(err).Panic("error parsing passthrough endpoint")
}

conn, err := grpc.Dial(passthroughURL.Host, grpc.WithInsecure())
conn, err := grpc.Dial(passthroughURL.Host, grpc.WithInsecure(), h.options)
if err != nil {
log.WithError(err).Panic("error dialing service")
}
Expand Down

0 comments on commit 99405c0

Please sign in to comment.