Skip to content

Commit

Permalink
removed signalctx, added NotifyContext (#170)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail <avramenkomihail15@gmail.com>
  • Loading branch information
Mixaster995 authored Apr 22, 2021
1 parent 4f76c97 commit f290055
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion internal/imports/imports_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
_ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
_ "github.com/networkservicemesh/sdk/pkg/tools/nsurl"
_ "github.com/networkservicemesh/sdk/pkg/tools/opentracing"
_ "github.com/networkservicemesh/sdk/pkg/tools/signalctx"
_ "github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
_ "github.com/networkservicemesh/sdk/pkg/tools/token"
_ "github.com/pkg/errors"
Expand All @@ -38,6 +37,8 @@ import (
_ "google.golang.org/grpc/credentials"
_ "net/url"
_ "os"
_ "os/signal"
_ "syscall"
_ "testing"
_ "time"
)
14 changes: 10 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"context"
"fmt"
"os"
"os/signal"
"syscall"

nested "github.com/antonfisher/nested-logrus-formatter"
"github.com/edwarnicke/grpcfd"
Expand Down Expand Up @@ -51,7 +53,6 @@ import (
"github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
"github.com/networkservicemesh/sdk/pkg/tools/nsurl"
"github.com/networkservicemesh/sdk/pkg/tools/opentracing"
"github.com/networkservicemesh/sdk/pkg/tools/signalctx"
"github.com/networkservicemesh/sdk/pkg/tools/spiffejwt"
"github.com/networkservicemesh/sdk/pkg/tools/token"

Expand All @@ -62,9 +63,14 @@ func main() {
// ********************************************************************************
// Configure signal handling context
// ********************************************************************************
ctx := signalctx.WithSignals(context.Background())
var cancel context.CancelFunc
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()

// ********************************************************************************
Expand Down

0 comments on commit f290055

Please sign in to comment.