forked from TrueCloudLab/frostfs-node
[#11] Trim the old functionality
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
783ec72d56
commit
a87fdab324
235 changed files with 39 additions and 36211 deletions
|
@ -2,6 +2,7 @@ package grace
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
@ -18,8 +19,12 @@ func NewGracefulContext(l *zap.Logger) context.Context {
|
|||
ch := make(chan os.Signal, 1)
|
||||
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
sig := <-ch
|
||||
l.Info("received signal",
|
||||
zap.String("signal", sig.String()))
|
||||
if l != nil {
|
||||
l.Info("received signal",
|
||||
zap.String("signal", sig.String()))
|
||||
} else {
|
||||
fmt.Printf("received signal %s\n", sig)
|
||||
}
|
||||
cancel()
|
||||
}()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue