Skip to content

Commit 005bb40

Browse files
committed
Skip select if drainEvents
Signed-off-by: JamesJJ <[email protected]>
1 parent aacea74 commit 005bb40

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fluent/fluent.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,6 @@ func (f *Fluent) run() {
356356
drainEvents := false
357357
var emitEventDrainMsg sync.Once
358358
for {
359-
select {
360-
case stopRunning, ok := <-f.stopRunning:
361-
if stopRunning || !ok {
362-
drainEvents = true
363-
}
364-
default:
365-
}
366359
select {
367360
case entry, ok := <-f.pending:
368361
if !ok {
@@ -378,6 +371,13 @@ func (f *Fluent) run() {
378371
fmt.Fprintf(os.Stderr, "[%s] Unable to send logs to fluentd, reconnecting...\n", time.Now().Format(time.RFC3339))
379372
}
380373
}
374+
select {
375+
case stopRunning, ok := <-f.stopRunning:
376+
if stopRunning || !ok {
377+
drainEvents = true
378+
}
379+
default:
380+
}
381381
}
382382
}
383383

0 commit comments

Comments
 (0)