mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 23:59:53 +00:00
Wire up forwarder.scanner configuration. (#173)
This commit is contained in:
@@ -64,7 +64,7 @@ func NewForwarder(metricsRegistry metrics.UsageRegistry, faulter *Faulter, optio
|
||||
Options: options,
|
||||
CloseNotify: closeNotify,
|
||||
}
|
||||
forwarder.scanner = newScanner(forwarder.sessions, 30 * time.Second, 30 * time.Second, forwarder.CloseNotify)
|
||||
forwarder.scanner = newScanner(forwarder.sessions, options.IdleTxInterval, options.IdleSessionTimeout, forwarder.CloseNotify)
|
||||
go forwarder.scanner.run()
|
||||
|
||||
return forwarder
|
||||
|
||||
@@ -26,6 +26,8 @@ type Options struct {
|
||||
LatencyProbeTimeout time.Duration
|
||||
XgressCloseCheckInterval time.Duration
|
||||
FaultTxInterval time.Duration
|
||||
IdleTxInterval time.Duration
|
||||
IdleSessionTimeout time.Duration
|
||||
XgressDial WorkerPoolOptions
|
||||
LinkDial WorkerPoolOptions
|
||||
}
|
||||
@@ -38,9 +40,11 @@ type WorkerPoolOptions struct {
|
||||
func DefaultOptions() *Options {
|
||||
return &Options{
|
||||
LatencyProbeInterval: 10 * time.Second,
|
||||
LatencyProbeTimeout: 10 * time.Second,
|
||||
LatencyProbeTimeout: 10 * time.Second,
|
||||
XgressCloseCheckInterval: 5 * time.Second,
|
||||
FaultTxInterval: 15 * time.Second,
|
||||
IdleTxInterval: 60 * time.Second,
|
||||
IdleSessionTimeout: 60 * time.Second,
|
||||
XgressDial: WorkerPoolOptions{
|
||||
QueueLength: 1000,
|
||||
WorkerCount: 10,
|
||||
@@ -83,7 +87,23 @@ func LoadOptions(src map[interface{}]interface{}) (*Options, error) {
|
||||
if val, ok := value.(int); ok {
|
||||
options.FaultTxInterval = time.Duration(val) * time.Millisecond
|
||||
} else {
|
||||
return nil, errors.New("invalid value for 'faultTxInterval")
|
||||
return nil, errors.New("invalid value for 'faultTxInterval'")
|
||||
}
|
||||
}
|
||||
|
||||
if value, found := src["idleTxInterval"]; found {
|
||||
if val, ok := value.(int); ok {
|
||||
options.IdleTxInterval = time.Duration(val) * time.Millisecond
|
||||
} else {
|
||||
return nil, errors.New("invalid value for 'idleTxInterval'")
|
||||
}
|
||||
}
|
||||
|
||||
if value, found := src["idleSessionTimeout"]; found {
|
||||
if val, ok := value.(int); ok {
|
||||
options.IdleSessionTimeout = time.Duration(val) * time.Millisecond
|
||||
} else {
|
||||
return nil, errors.New("invalid value for 'idleSessionTimeout'")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user