From d1bb23645e7a16430e712bd0ea0c768082bea8e3 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 1 Sep 2022 13:08:34 -0700 Subject: [PATCH] Revert "avoid data race on grace.hooks (#3572)" This reverts commit c37d6fc01a8b70ea3686a81c2acf9d3da0b5ef09. --- weed/util/grace/signal_handling.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/weed/util/grace/signal_handling.go b/weed/util/grace/signal_handling.go index 24d2b184f..fc7afcad9 100644 --- a/weed/util/grace/signal_handling.go +++ b/weed/util/grace/signal_handling.go @@ -12,7 +12,7 @@ import ( var signalChan chan os.Signal var hooks = make([]func(), 0) -var hookLock sync.RWMutex +var hookLock sync.Mutex func init() { signalChan = make(chan os.Signal, 1) @@ -27,9 +27,7 @@ func init() { // syscall.SIGQUIT, ) go func() { - hookLock.RLock() - defer hookLock.RUnlock() - for range signalChan { + for _ = range signalChan { for _, hook := range hooks { hook() }