From ac5b8b82871ce178fd093ed2a46a3e66dedf37f2 Mon Sep 17 00:00:00 2001 From: Annika Hannig Date: Fri, 26 May 2023 11:50:07 +0200 Subject: [PATCH] set stream parser throttle --- pkg/config/config.go | 8 ++++++++ pkg/config/config_test.go | 3 +++ pkg/config/testdata/alice.conf | 2 ++ 3 files changed, 13 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index aafb782..934b82d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -82,6 +82,7 @@ type ServerConfig struct { StoreBackend string `ini:"store_backend"` Asn int `ini:"asn"` EnableNeighborsStatusRefresh bool `ini:"enable_neighbors_status_refresh"` + StreamParserThrottle int `ini:"stream_parser_throttle"` } // PostgresConfig is the configuration for the database @@ -884,6 +885,13 @@ func LoadConfig(file string) (*Config, error) { return nil, err } + // Update stream parser throttle on all birdwatcher sources + for _, src := range sources { + if src.Backend == SourceBackendBirdwatcher { + src.Birdwatcher.StreamParserThrottle = server.StreamParserThrottle + } + } + config := &Config{ Server: server, Postgres: psql, diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index c34fc86..6bdd956 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -69,6 +69,9 @@ func TestSourceConfig(t *testing.T) { if rs2.Birdwatcher.AltPipeProtocolSuffix != "_lg" { t.Error("unexpected alt_pipe_suffix:", rs2.Birdwatcher.AltPipeProtocolSuffix) } + if rs2.Birdwatcher.StreamParserThrottle != 2342 { + t.Error("Unexpected StreamParserThrottle", rs2.Birdwatcher.StreamParserThrottle) + } } nilGoBGPConfig := gobgp.Config{} if rs3.GoBGP == nilGoBGPConfig { diff --git a/pkg/config/testdata/alice.conf b/pkg/config/testdata/alice.conf index 54cf295..03fecff 100644 --- a/pkg/config/testdata/alice.conf +++ b/pkg/config/testdata/alice.conf @@ -25,6 +25,8 @@ neighbors_store_refresh_parallelism = 10000 routes_store_refresh_interval = 5 neighbors_store_refresh_interval = 5 +stream_parser_throttle = 2342 + store_backend = postgres [postgres]