allow configuring signal message buffer size (#1504)
* allow configuring signal message buffer size * update psrpc
This commit is contained in:
+10
-8
@@ -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{},
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user