Skip to content

Commit 06bfef4

Browse files
authored
Merge pull request #407 from authzed/up-max-message-size-limit
Add option for max message size
2 parents 167d6bc + a37016e commit 06bfef4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

internal/client/client.go

+12
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,17 @@ func DialOptsFromFlags(cmd *cobra.Command, token storage.Token) ([]grpc.DialOpti
113113
opts = append(opts, grpc.WithAuthority(hostnameOverride))
114114
}
115115

116+
maxMessageSize := cobrautil.MustGetInt(cmd, "max-message-size")
117+
if maxMessageSize != 0 {
118+
opts = append(opts, grpc.WithDefaultCallOptions(
119+
// The default max client message size is 4mb.
120+
// It's conceivable that a sufficiently complex
121+
// schema will easily surpass this, so we set the
122+
// limit higher here.
123+
grpc.MaxCallRecvMsgSize(maxMessageSize),
124+
grpc.MaxCallSendMsgSize(maxMessageSize),
125+
))
126+
}
127+
116128
return opts, nil
117129
}

internal/cmd/cmd.go

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func Run() {
7575
rootCmd.PersistentFlags().Bool("no-verify-ca", false, "do not attempt to verify the server's certificate chain and host name")
7676
rootCmd.PersistentFlags().Bool("debug", false, "enable debug logging")
7777
rootCmd.PersistentFlags().String("request-id", "", "optional id to send along with SpiceDB requests for tracing")
78+
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")
7879
_ = rootCmd.PersistentFlags().MarkHidden("debug") // This cannot return its error.
7980

8081
versionCmd := &cobra.Command{

0 commit comments

Comments
 (0)