Skip to content

Commit

Permalink
Remove unnecessary locking
Browse files Browse the repository at this point in the history
  • Loading branch information
lahsivjar committed Aug 18, 2022
1 parent 329a670 commit 92312d8
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions internal/beater/beater.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,19 +690,12 @@ func (s *serverRunner) waitReady(ctx context.Context, kibanaClient kibana.Client
return waitReady(ctx, s.config.WaitReadyInterval, s.tracer, s.logger, check)
}

// This mutex must be held when updating the libbeat monitoring registry,
// as there may be multiple servers running concurrently.
var monitoringRegistryMu sync.Mutex

// newFinalBatchProcessor returns the final model.BatchProcessor that publishes events,
// and a cleanup function which should be called on server shutdown. If the output is
// "elasticsearch", then we use modelindexer; otherwise we use the libbeat publisher.
func (s *serverRunner) newFinalBatchProcessor(
newElasticsearchClient func(cfg *elasticsearch.Config) (elasticsearch.Client, error),
) (model.BatchProcessor, func(context.Context) error, error) {
monitoringRegistryMu.Lock()
defer monitoringRegistryMu.Unlock()

if s.elasticsearchOutputConfig == nil {
// When the publisher stops cleanly it will close its pipeline client,
// calling the acker's Close method. We need to call Open for each new
Expand Down

0 comments on commit 92312d8

Please sign in to comment.