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
aaronbuchwald authored and cp-wjhan committed Nov 28, 2022
1 parent 24ea3e0 commit 737be2b
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 737be2b

Please sign in to comment.