allow configuring signal message buffer size (#1504)

* allow configuring signal message buffer size

* update psrpc
This commit is contained in:
Paul Wells
2023-03-08 17:34:14 -08:00
committed by GitHub
parent 2c93d55e5c
commit 54bf7e0dac
5 changed files with 46 additions and 37 deletions
+10 -8
View File
@@ -229,10 +229,11 @@ type NodeSelectorConfig struct {
}
type SignalRelayConfig struct {
Enabled bool `yaml:"enabled"`
MaxAttempts int `yaml:"max_attempts"`
Timeout time.Duration `yaml:"timeout"`
Backoff time.Duration `yaml:"backoff"`
Enabled bool `yaml:"enabled"`
MaxAttempts int `yaml:"max_attempts"`
Timeout time.Duration `yaml:"timeout"`
Backoff time.Duration `yaml:"backoff"`
StreamBufferSize int `yaml:"stream_buffer_size"`
}
// RegionConfig lists available regions and their latitude/longitude, so the selector would prefer
@@ -405,10 +406,11 @@ func NewConfig(confString string, strictMode bool, c *cli.Context, baseFlags []c
CPULoadLimit: 0.9,
},
SignalRelay: SignalRelayConfig{
Enabled: false,
MaxAttempts: 3,
Timeout: 500 * time.Millisecond,
Backoff: 500 * time.Millisecond,
Enabled: false,
MaxAttempts: 3,
Timeout: 500 * time.Millisecond,
Backoff: 500 * time.Millisecond,
StreamBufferSize: 1000,
},
Keys: map[string]string{},
}
+2
View File
@@ -23,6 +23,7 @@ type SignalClient interface {
type signalClient struct {
nodeID livekit.NodeID
config config.SignalRelayConfig
client rpc.TypedSignalClient
}
@@ -39,6 +40,7 @@ func NewSignalClient(nodeID livekit.NodeID, bus psrpc.MessageBus, config config.
return &signalClient{
nodeID: nodeID,
config: config,
client: c,
}, nil
}
+1 -1
View File
@@ -41,7 +41,7 @@ func NewSignalServer(
Timeout: config.Timeout,
Backoff: config.Backoff,
})
s, err := rpc.NewTypedSignalServer(nodeID, &signalService{region, sessionHandler}, bus, psrpc.WithServerStreamInterceptors(ri))
s, err := rpc.NewTypedSignalServer(nodeID, &signalService{region, sessionHandler}, bus, psrpc.WithServerStreamInterceptors(ri), psrpc.WithServerChannelSize(config.StreamBufferSize))
if err != nil {
return nil, err
}