Skip to content

Commit

Permalink
cshared: Make non-blocking for checking existence of the channel
Browse files Browse the repository at this point in the history
Without using Mutex.TryLock(), this golang interface causes the main
fluent-bit process stuck on pause.
This shouldn't be desired behavior.

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Oct 12, 2023
1 parent 509eb21 commit ac82d67
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cshared.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ func cleanup() int {
runCancel = nil
}

theInputLock.Lock()
if !theInputLock.TryLock() {
return input.FLB_OK
}
defer theInputLock.Unlock()

if theChannel != nil {
Expand Down Expand Up @@ -258,7 +260,9 @@ func FLBPluginInputPause() {
runCancel = nil
}

theInputLock.Lock()
if !theInputLock.TryLock() {
return
}
defer theInputLock.Unlock()

if theChannel != nil {
Expand Down Expand Up @@ -290,7 +294,9 @@ func FLBPluginOutputPreExit() {
runCancel = nil
}

theInputLock.Lock()
if !theInputLock.TryLock() {
return
}
defer theInputLock.Unlock()

if theChannel != nil {
Expand Down

0 comments on commit ac82d67

Please sign in to comment.