Skip to content

Commit

Permalink
Merge pull request #94 from Mixaster995/main
Browse files Browse the repository at this point in the history
fix networkservicemesh/sdk#759 - removed signalctx, added NotifyContext
  • Loading branch information
denis-tingaikin authored Apr 22, 2021
2 parents eec67cc + 2d1514d commit 6134416
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 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
14 changes: 11 additions & 3 deletions 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 All @@ -39,7 +41,6 @@ import (
"github.com/networkservicemesh/sdk/pkg/tools/grpcutils"
"github.com/networkservicemesh/sdk/pkg/tools/log"
"github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
"github.com/networkservicemesh/sdk/pkg/tools/signalctx"
)

// Config is configuration for cmd-registry-memory
Expand All @@ -51,8 +52,15 @@ type Config struct {
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 6134416

Please sign in to comment.