Skip to content

Commit

Permalink
Flush Buffer before Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitimmer committed Nov 4, 2024
1 parent 3b46198 commit d6b5727
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,12 @@ func FLBPluginExit() int {

//export FLBPluginExitCtx
func FLBPluginExitCtx(ctx unsafe.Pointer) int {
metricsServer.Stop()
defer metricsServer.Stop()
err := client.BufferWrite()
if err != nil {
log.Error(nil, "Error while writing buffer", zap.Error(err))
return output.FLB_ERROR
}
return output.FLB_OK
}

Expand Down

0 comments on commit d6b5727

Please sign in to comment.