Skip to content

Commit

Permalink
removed signalctx, added NotifyContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixaster995 committed Apr 22, 2021
1 parent 86abb2c commit 99c70c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.15-buster as go
FROM golang:1.16-buster as go
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOBIN=/bin
Expand Down
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"net/url"
"os"
"os/signal"
"syscall"
"time"

"github.com/networkservicemesh/sdk-k8s/pkg/registry/chains/registryk8s"
Expand Down Expand Up @@ -52,7 +54,15 @@ func main() {
var config = new(Config)
// Setup context to catch signals
ctx := signalctx.WithSignals(context.Background())
ctx, cancel := context.WithCancel(ctx)
ctx, cancel := signal.NotifyContext(
context.Background(),
os.Interrupt,
// More Linux signals here
syscall.SIGHUP,
syscall.SIGTERM,
syscall.SIGQUIT,
)
defer cancel()

// Setup logging
logrus.SetFormatter(&nested.Formatter{})
Expand Down
2 changes: 2 additions & 0 deletions pkg/internal/imports/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ import (
_ "google.golang.org/grpc/credentials"
_ "net/url"
_ "os"
_ "os/signal"
_ "syscall"
_ "time"
)

0 comments on commit 99c70c8

Please sign in to comment.