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

dep:upgrade polaris-go version #65

Merged
merged 1 commit into from
Jun 21, 2024
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 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 @@
"os/signal"
"strconv"
"strings"
"sync/atomic"
"syscall"
"time"

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

// NewServer start polaris server
Expand Down Expand Up @@ -72,7 +74,7 @@
for _, opt := range opts {
opt.apply(&srv.serverOptions)
}
srv.serverOptions.setDefault()

Check failure on line 77 in server.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.18.x)

Error return value of `srv.serverOptions.setDefault` is not checked (errcheck)

Check failure on line 77 in server.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.17.x)

Error return value of `srv.serverOptions.setDefault` is not checked (errcheck)

Check failure on line 77 in server.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.15.x)

Error return value of `srv.serverOptions.setDefault` is not checked (errcheck)

Check failure on line 77 in server.go

View workflow job for this annotation

GitHub Actions / golangci-lint (1.16.x)

Error return value of `srv.serverOptions.setDefault` is not checked (errcheck)

if *srv.serverOptions.delayRegisterEnable {
delayStrategy := srv.serverOptions.delayRegisterStrategy
Expand Down Expand Up @@ -126,7 +128,7 @@

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 @@

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

srv.Deregister()

if !*srv.serverOptions.gracefulStopEnable {
Expand Down
Loading