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 sadoci committed Jan 27, 2023
1 parent 357940e commit c4172dd
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 c4172dd

Please sign in to comment.