}
if !atomic.CompareAndSwapInt32(
&p.status,
common.DaemonStatusStarted,
common.DaemonStatusStopped,
) {
return
}
defer p.shutdownLock.Unlock()
err := p.bulkProcessor.Stop()
if err != nil {
// This could happen if ES is down when we're trying to shut down the server.
p.logger.Error("Unable to stop Elasticsearch processor.", tag.LifeCycleStopFailed, tag.Error(err))