Skip to content

Commit

Permalink
Improve logging control flow
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Nov 4, 2022
1 parent 70b5813 commit f6f644f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion log/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ func log(level Severity, msg string, tracer *ContextTracer) {

// wake up writer if necessary
if logsWaitingFlag.SetToIf(false, true) {
logsWaiting <- struct{}{}
select {
case logsWaiting <- struct{}{}:
default:
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion log/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var (
pkgLevels = make(map[string]Severity)
pkgLevelsLock sync.Mutex

logsWaiting = make(chan struct{}, 4)
logsWaiting = make(chan struct{}, 1)
logsWaitingFlag = abool.NewBool(false)

shutdownFlag = abool.NewBool(false)
Expand Down

0 comments on commit f6f644f

Please sign in to comment.