Skip to content

Commit

Permalink
dep:upgrade polaris-go version (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntaojun authored Jun 21, 2024
1 parent 6916060 commit 14c7543
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/golang/protobuf v1.5.4
github.com/google/uuid v1.6.0
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/polarismesh/polaris-go v1.6.0-beta.4
github.com/polarismesh/polaris-go v1.6.0-beta.5
github.com/polarismesh/specification v1.5.1
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/common v0.54.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1695,8 +1695,8 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/polarismesh/polaris-go v1.6.0-beta.4 h1:II1PVHU9NJtbzZcZj6MMQH7tYjjUrxJQDu9x1dOYhdk=
github.com/polarismesh/polaris-go v1.6.0-beta.4/go.mod h1:CuXO9bhHGjSoOIMWr4NXf3bJAkRBp5YoM7ibBzENC+c=
github.com/polarismesh/polaris-go v1.6.0-beta.5 h1:llucvfydWlFWTNeABHbbuVL2ijR7AITx8UG02tx0c/Y=
github.com/polarismesh/polaris-go v1.6.0-beta.5/go.mod h1:CuXO9bhHGjSoOIMWr4NXf3bJAkRBp5YoM7ibBzENC+c=
github.com/polarismesh/specification v1.4.1/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
github.com/polarismesh/specification v1.5.1 h1:cJ2m0RBepdopGo/e3UpKdsab3NpDZnw5IsVTB1sFc5I=
github.com/polarismesh/specification v1.5.1/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
Expand Down
8 changes: 7 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"os/signal"
"strconv"
"strings"
"sync/atomic"
"syscall"
"time"

Expand All @@ -42,6 +43,7 @@ type Server struct {
sdkCtx api.SDKContext
providerAPI api.ProviderAPI
registerRequests []*api.InstanceRegisterRequest
isStop int32
}

// NewServer start polaris server
Expand Down Expand Up @@ -126,7 +128,7 @@ func (srv *Server) Serve(lis net.Listener) error {

go func() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
signal.Notify(c, syscall.SIGSEGV, syscall.SIGINT, syscall.SIGTERM)
s := <-c
log.Printf("[Polaris][Naming] receive quit signal: %v", s)
signal.Stop(c)
Expand All @@ -138,6 +140,10 @@ func (srv *Server) Serve(lis net.Listener) error {

// Stop deregister and stop
func (srv *Server) Stop() {
if !atomic.CompareAndSwapInt32(&srv.isStop, 0, 1) {
return
}

srv.Deregister()

if !*srv.serverOptions.gracefulStopEnable {
Expand Down

0 comments on commit 14c7543

Please sign in to comment.