Skip to content

Commit

Permalink
handle a panic in the goroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
rkanson committed Jul 19, 2024
1 parent a8fea7f commit ad50ff2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ func fetchRmemMax() int {
}

func handleMsg(msg *syscall.NetlinkMessage, marshaller *marshaller.AuditMarshaller) {
defer func() {
if r := recover(); r != nil {
slog.Error.Printf("Panic occurred in handleMsg: %v", r)
}
}()

timing := metric.GetClient().NewTiming() // measure latency from recipt of message
metric.GetClient().Increment("messages.total")

Expand Down

0 comments on commit ad50ff2

Please sign in to comment.