From 415a39c679f0cabccc3e620cdddbecd6afea31b5 Mon Sep 17 00:00:00 2001 From: Mitja T Date: Wed, 14 Feb 2024 18:28:55 -0800 Subject: [PATCH] rename helpers -> cachingProxies --- cmd/analyzer/analyzer.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/analyzer/analyzer.go b/cmd/analyzer/analyzer.go index 7b00a22bc..b77686718 100644 --- a/cmd/analyzer/analyzer.go +++ b/cmd/analyzer/analyzer.go @@ -151,7 +151,7 @@ func wipeStorage(cfg *config.StorageConfig) error { type Service struct { analyzers []SyncedAnalyzer fastSyncAnalyzers []SyncedAnalyzer - helpers []*http.Server + cachingProxies []*http.Server sources *sourceFactory target storage.TargetStorage @@ -282,14 +282,14 @@ func NewService(cfg *config.AnalysisConfig) (*Service, error) { //nolint:gocyclo return nil, err } - // Initialize analyzer helpers. - helpers := []*http.Server{} + // Initialize analyzer cachingProxies. + cachingProxies := []*http.Server{} for _, proxyCfg := range cfg.Helpers.CachingProxies { - helper, err2 := httpproxy.NewHttpServer(*cfg.Source.Cache, proxyCfg) + proxy, err2 := httpproxy.NewHttpServer(*cfg.Source.Cache, proxyCfg) if err2 != nil { return nil, err2 } - helpers = append(helpers, helper) + cachingProxies = append(cachingProxies, proxy) } // Initialize fast-sync analyzers. @@ -510,7 +510,7 @@ func NewService(cfg *config.AnalysisConfig) (*Service, error) { //nolint:gocyclo return &Service{ fastSyncAnalyzers: fastSyncAnalyzers, analyzers: analyzers, - helpers: helpers, + cachingProxies: cachingProxies, sources: sources, target: dbClient, @@ -526,12 +526,12 @@ func (a *Service) Start() { ctx, cancelAnalyzers := context.WithCancel(context.Background()) defer cancelAnalyzers() // Start() only returns when analyzers are done, so this should be a no-op, but it makes the compiler happier. - // Start helpers. - for _, helper := range a.helpers { - helper := helper + // Start caching proxies. + for _, proxy := range a.cachingProxies { + proxy := proxy go func() { - if err := helper.ListenAndServe(); err != nil { - a.logger.Error("helper server failed", "server_addr", helper.Addr, "error", err.Error()) + if err := proxy.ListenAndServe(); err != nil { + a.logger.Error("caching proxy server failed", "server_addr", proxy.Addr, "error", err.Error()) } }() }