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 JacekGlen committed May 26, 2022
1 parent 928669a commit 19310f9
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 19310f9

Please sign in to comment.