[#11] Trim the old functionality

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-08-21 14:32:03 +03:00 committed by Alex Vanin
parent 783ec72d56
commit a87fdab324
235 changed files with 39 additions and 36211 deletions

View file

@ -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()
}()