Skip to content

Commit

Permalink
Merge pull request #135 from Mixaster995/main
Browse files Browse the repository at this point in the history
removed signalctx, added NotifyContext
  • Loading branch information
denis-tingaikin authored Apr 22, 2021
2 parents b95f49d + 6273237 commit 0b4411d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 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
3 changes: 2 additions & 1 deletion internal/imports/imports_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
_ "github.com/networkservicemesh/sdk/pkg/tools/log"
_ "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
_ "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/spire"
_ "github.com/networkservicemesh/sdk/pkg/tools/token"
Expand All @@ -52,9 +51,11 @@ import (
_ "k8s.io/kubelet/pkg/apis/podresources/v1alpha1"
_ "net/url"
_ "os"
_ "os/signal"
_ "path"
_ "path/filepath"
_ "sync"
_ "syscall"
_ "testing"
_ "time"
)
14 changes: 11 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import (
"io/ioutil"
"net/url"
"os"
"os/signal"
"path"
"syscall"
"time"

nested "github.com/antonfisher/nested-logrus-formatter"
Expand Down Expand Up @@ -51,7 +53,6 @@ import (
"github.com/networkservicemesh/sdk/pkg/tools/log"
"github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger"
"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 @@ -78,8 +79,15 @@ 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
Expand Down

0 comments on commit 0b4411d

Please sign in to comment.