Skip to content

Commit

Permalink
Merge pull request #407 from authzed/up-max-message-size-limit
Browse files Browse the repository at this point in the history
Add option for max message size
  • Loading branch information
tstirrat15 authored Aug 28, 2024
2 parents 167d6bc + a37016e commit 06bfef4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,17 @@ func DialOptsFromFlags(cmd *cobra.Command, token storage.Token) ([]grpc.DialOpti
opts = append(opts, grpc.WithAuthority(hostnameOverride))
}

maxMessageSize := cobrautil.MustGetInt(cmd, "max-message-size")
if maxMessageSize != 0 {
opts = append(opts, 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(maxMessageSize),
grpc.MaxCallSendMsgSize(maxMessageSize),
))
}

return opts, nil
}
1 change: 1 addition & 0 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func Run() {
rootCmd.PersistentFlags().Bool("no-verify-ca", false, "do not attempt to verify the server's certificate chain and host name")
rootCmd.PersistentFlags().Bool("debug", false, "enable debug logging")
rootCmd.PersistentFlags().String("request-id", "", "optional id to send along with SpiceDB requests for tracing")
rootCmd.PersistentFlags().Int("max-message-size", 0, "maximum size in bytes (defaults to 4mb) of a gRPC message that can be sent or received by zed")
_ = rootCmd.PersistentFlags().MarkHidden("debug") // This cannot return its error.

versionCmd := &cobra.Command{
Expand Down

0 comments on commit 06bfef4

Please sign in to comment.