Browse Source

Revert "avoid data race on grace.hooks (#3572)"

This reverts commit c37d6fc01a.
pull/3579/head
chrislu 2 years ago
parent
commit
d1bb23645e
  1. 6
      weed/util/grace/signal_handling.go

6
weed/util/grace/signal_handling.go

@ -12,7 +12,7 @@ import (
var signalChan chan os.Signal var signalChan chan os.Signal
var hooks = make([]func(), 0) var hooks = make([]func(), 0)
var hookLock sync.RWMutex
var hookLock sync.Mutex
func init() { func init() {
signalChan = make(chan os.Signal, 1) signalChan = make(chan os.Signal, 1)
@ -27,9 +27,7 @@ func init() {
// syscall.SIGQUIT, // syscall.SIGQUIT,
) )
go func() { go func() {
hookLock.RLock()
defer hookLock.RUnlock()
for range signalChan {
for _ = range signalChan {
for _, hook := range hooks { for _, hook := range hooks {
hook() hook()
} }

Loading…
Cancel
Save