Skip to content

Commit b6f3b3e

Browse files
committed
refactor(pusher): Simplify fail callback to direct method reference
🤖 Assisted by AI
1 parent 334acdf commit b6f3b3e

File tree

1 file changed

+1
-8
lines changed
  • plugins/outputs/cloudwatchlogs/internal/pusher

1 file changed

+1
-8
lines changed

plugins/outputs/cloudwatchlogs/internal/pusher/queue.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (q *queue) merge(mergeChan chan logs.LogEvent) {
182182
func (q *queue) send() {
183183
if len(q.batch.events) > 0 {
184184
q.batch.addDoneCallback(q.onSuccessCallback(q.batch.bufferedSize))
185-
q.batch.addFailCallback(q.onFailCallback())
185+
q.batch.addFailCallback(q.halt)
186186

187187
// Wait if halted (circuit breaker)
188188
q.waitIfHalted()
@@ -291,10 +291,3 @@ func (q *queue) resume() {
291291
q.haltCh = make(chan struct{})
292292
}
293293
}
294-
295-
// onFailCallback returns a callback function to be executed after a failed send
296-
func (q *queue) onFailCallback() func() {
297-
return func() {
298-
q.halt()
299-
}
300-
}

0 commit comments

Comments
 (0)