Skip to content

Commit

Permalink
log: modify lock defer unlock order in sync handler (ethereum#24667)
Browse files Browse the repository at this point in the history
This modifies the order of Lock() defer Unlock() to follow the more
typically used pattern.
  • Loading branch information
gzliudan committed Nov 15, 2024
1 parent 258cbb3 commit bfb3f76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler {
func SyncHandler(h Handler) Handler {
var mu sync.Mutex
return FuncHandler(func(r *Record) error {
defer mu.Unlock()
mu.Lock()
defer mu.Unlock()

return h.Log(r)
})
}
Expand Down

0 comments on commit bfb3f76

Please sign in to comment.