Skip to content

Commit

Permalink
Remove lock around HA state.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobz committed Mar 13, 2024
1 parent 90e5cf0 commit a631176
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions pkg/logs/sender/destination_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type DestinationSender struct {
destination client.Destination
retryReader chan bool
stopChan <-chan struct{}
haLock sync.Mutex
retryLock sync.Mutex
lastRetryState bool
cancelSendChan chan struct{}
Expand All @@ -43,7 +42,6 @@ func NewDestinationSender(config pkgconfigmodel.Reader, destination client.Desti
destination: destination,
retryReader: retryReader,
stopChan: stopChan,
haLock: sync.Mutex{},
retryLock: sync.Mutex{},
lastRetryState: false,
cancelSendChan: nil,
Expand Down Expand Up @@ -81,20 +79,14 @@ func (d *DestinationSender) canSend() bool {
if d.destination.IsHA() {
if !d.sendEnabled {
if d.config.GetBool("ha.enabled") && d.config.GetBool("ha.failover") {
d.haLock.Lock()
d.sendEnabled = true
d.haLock.Unlock()

log.Infof("Forwarder for domain %v has been failed over to, enabling it for HA.", d.destination.Target())
} else {
log.Debugf("Forwarder for domain %v is disabled; dropping transaction for this domain.", d.destination.Target())
}
} else {
if !d.config.GetBool("ha.enabled") || !d.config.GetBool("ha.failover") {
d.haLock.Lock()
d.sendEnabled = false
d.haLock.Unlock()

log.Infof("Forwarder for domain %v was disabled; transactions will be dropped for this domain.", d.destination.Target())
}
}
Expand Down

0 comments on commit a631176

Please sign in to comment.