diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-10-12 19:18:40 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-12 07:18:40 -0700 |
| commit | 401315f33750c7fa0374c00bcba8f26f8b67fe7b (patch) | |
| tree | e6e22cbdb5f02f92b23d33eb5ef9c2eeddce278e /weed/util/grace/signal_handling.go | |
| parent | a05725aea6b6c4e99a5b6d9541b94fd7bbd15ab9 (diff) | |
| download | seaweedfs-401315f33750c7fa0374c00bcba8f26f8b67fe7b.tar.xz seaweedfs-401315f33750c7fa0374c00bcba8f26f8b67fe7b.zip | |
master fix interruption through ctrl+c (#3834)
Diffstat (limited to 'weed/util/grace/signal_handling.go')
| -rw-r--r-- | weed/util/grace/signal_handling.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/util/grace/signal_handling.go b/weed/util/grace/signal_handling.go index 14b998796..0fc0f43e1 100644 --- a/weed/util/grace/signal_handling.go +++ b/weed/util/grace/signal_handling.go @@ -4,8 +4,11 @@ package grace import ( + "github.com/seaweedfs/seaweedfs/weed/glog" "os" "os/signal" + "reflect" + "runtime" "sync" "syscall" ) @@ -16,6 +19,10 @@ var interruptHookLock sync.RWMutex var reloadHooks = make([]func(), 0) var reloadHookLock sync.RWMutex +func GetFunctionName(i interface{}) string { + return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name() +} + func init() { signalChan = make(chan os.Signal, 1) signal.Notify(signalChan, @@ -38,6 +45,7 @@ func init() { } else { interruptHookLock.RLock() for _, hook := range interruptHooks { + glog.V(4).Infof("exec interrupt hook func name:%s", GetFunctionName(hook)) hook() } interruptHookLock.RUnlock() |
