config: warn if connmgr limits conflict with rcmgr (#2527)

Co-authored-by: Sukun <sukunrt@gmail.com>
This commit is contained in:
piersy
2023-09-25 14:09:46 +01:00
committed by GitHub
parent f6995b14ea
commit 7f72151bcc
6 changed files with 57 additions and 0 deletions

View File

@@ -295,6 +295,15 @@ func (cfg *Config) addTransports(h host.Host) error {
//
// This function consumes the config. Do not reuse it (really!).
func (cfg *Config) NewNode() (host.Host, error) {
// If possible check that the resource manager conn limit is higher than the
// limit set in the conn manager.
if l, ok := cfg.ResourceManager.(connmgr.GetConnLimiter); ok {
err := cfg.ConnManager.CheckLimit(l)
if err != nil {
log.Warn(fmt.Sprintf("rcmgr limit conflicts with connmgr limit: %v", err))
}
}
eventBus := eventbus.NewBus(eventbus.WithMetricsTracer(eventbus.NewMetricsTracer(eventbus.WithRegisterer(cfg.PrometheusRegisterer))))
swrm, err := cfg.makeSwarm(eventBus, !cfg.DisableMetrics)
if err != nil {