Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed signalctx, added NotifyContext #118

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/pkg/tools/opentracing"
Expand All @@ -40,7 +42,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-nsmgr-proxy
Expand All @@ -52,8 +53,15 @@ type Config struct {

func main() {
// 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/imports/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import (
_ "google.golang.org/grpc/health/grpc_health_v1"
_ "net/url"
_ "os"
_ "os/signal"
_ "path/filepath"
_ "syscall"
_ "testing"
_ "time"
)