Skip to content

Commit

Permalink
Up max message size
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Aug 28, 2024
1 parent 167d6bc commit 931c403
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ type Client interface {
// NewClient defines an (overridable) means of creating a new client.
var NewClient = newGRPCClient

const oneGb = 1 * 1024 * 1024 * 1024

var defaultCallOptions = grpc.WithDefaultCallOptions(
// The default max client message size is 4mb.
// It's conceivable that a sufficiently complex
// schema will easily surpass this, so we set the
// limit higher here.
grpc.MaxCallRecvMsgSize(oneGb),
grpc.MaxCallSendMsgSize(oneGb),
)

func newGRPCClient(cmd *cobra.Command) (Client, error) {
configStore, secretStore := DefaultStorage()
token, err := storage.DefaultToken(
Expand All @@ -43,11 +54,15 @@ func newGRPCClient(cmd *cobra.Command) (Client, error) {
}
log.Trace().Interface("token", token).Send()

dialOpts, err := DialOptsFromFlags(cmd, token)
flagDialOpts, err := DialOptsFromFlags(cmd, token)
if err != nil {
return nil, err
}

// NOTE: this works as long as we don't have CallOptions
// defined in flags. We'll have to modify this logic then.
dialOpts := append(flagDialOpts, defaultCallOptions)

client, err := authzed.NewClientWithExperimentalAPIs(token.Endpoint, dialOpts...)
if err != nil {
return nil, err
Expand Down

0 comments on commit 931c403

Please sign in to comment.