address review comments
- increase shutdown limit to 10/11 sec as it was set in isp-lib/bootstrap - refactor - update libs versions to released
This commit is contained in:
1 parent
a5b21198e0
commit
2e33c2275c
4 files changed
+15
-14
No files matched your search
+1
-1
@@ -121,7 +121,7 @@ func (client *Client) listenLeader() {
|
||||
if n.LeaderElected && !n.IsLeader {
|
||||
leaderAddr := n.CurrentLeaderAddress
|
||||
leaderClient := NewSocketLeaderClient(leaderAddr, func() {
|
||||
go client.onClientDisconnect(leaderAddr)
|
||||
client.onClientDisconnect(leaderAddr)
|
||||
})
|
||||
if err := leaderClient.Dial(leaderConnectionTimeout); err != nil {
|
||||
log.Fatalf(codes.LeaderClientConnectionError, "could not connect to leader: %v", err)
|
||||
|
||||
@@ -9,11 +9,11 @@ require (
|
||||
github.com/hashicorp/raft v1.2.0
|
||||
github.com/hashicorp/raft-boltdb/v2 v2.0.0-20210409134258-03c10cc3d4ea
|
||||
github.com/integration-system/bellows v1.0.1
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3-0.20210430094727-13f5801ec901
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3
|
||||
github.com/integration-system/isp-lib-test v1.6.3
|
||||
github.com/integration-system/isp-lib/v2 v2.8.4
|
||||
github.com/integration-system/isp-log v1.1.6
|
||||
github.com/integration-system/net-mux v1.0.1-0.20210421105716-b82154781dac
|
||||
github.com/integration-system/net-mux v1.0.1
|
||||
github.com/json-iterator/go v1.1.10
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
|
||||
github.com/pkg/errors v0.9.1
|
||||
|
||||
@@ -303,8 +303,8 @@ github.com/integration-system/go-cmp v0.0.0-20190131081942-ac5582987a2f/go.mod h
|
||||
github.com/integration-system/gowsdl v1.0.0/go.mod h1:ZwTCE+Av5aQLnPj2/3PIop6mzCs1FY7jXrcWDvSjrBA=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.1/go.mod h1:Ndq5DMM3sDJjZn4cyKKvZrVED0FMeoXMRWHZTq+2Z1o=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.2/go.mod h1:fSkS09/engepaDDqaDAEeXUpzmtcMpSLjilZ35BfNcc=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3-0.20210430094727-13f5801ec901 h1:NMGklTh9ninOUdykg20nJXa/bJ5DtYP41TNCVUwpJyE=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3-0.20210430094727-13f5801ec901/go.mod h1:ZpB+FIH3hy7md+f8ylVSQx5zwZVjczhkc45f1B2z9nw=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3 h1:vcHP/PE7p1G3rxqoVKrKtXzoSxFA4ryxigd+zPkAb3w=
|
||||
github.com/integration-system/isp-etp-go/v2 v2.1.3/go.mod h1:ZpB+FIH3hy7md+f8ylVSQx5zwZVjczhkc45f1B2z9nw=
|
||||
github.com/integration-system/isp-event-lib v1.6.0/go.mod h1:lCzAci6oS+vc51W8EfHVCh9p3p057r0DpMuY4T0lSj0=
|
||||
github.com/integration-system/isp-event-lib v1.6.1 h1:8frVxZKGEjBH1M5ghVrMijQzLfM9F45uiN403IgJJao=
|
||||
github.com/integration-system/isp-event-lib v1.6.1/go.mod h1:5ZIXsMG3gC7sfQ+eICjkDpy2RSvSAxV3Cq1BVN8LFIk=
|
||||
@@ -323,8 +323,8 @@ github.com/integration-system/isp-log v1.1.6/go.mod h1:TpUZ/Tx84sRipAT/YXZ8V7Z21
|
||||
github.com/integration-system/jsonschema v1.0.0/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0=
|
||||
github.com/integration-system/jsonschema v1.0.1 h1:nR78BEDG9djX2uXQ1YP66a/9yQOMmp2HFmw8VPUdAa8=
|
||||
github.com/integration-system/jsonschema v1.0.1/go.mod h1:EoqDH7RmC8Epg5EgjboIxDo7Udv3WX2exGqtIVB4hI0=
|
||||
github.com/integration-system/net-mux v1.0.1-0.20210421105716-b82154781dac h1:g0cYcgPGnkNxhsBC6x8/rQRMUNUh3MPHoG1aG1HNKBY=
|
||||
github.com/integration-system/net-mux v1.0.1-0.20210421105716-b82154781dac/go.mod h1:0iEskyZB58/VwtFu8BATYMmPse2ZU9WWv6agidMEAs0=
|
||||
github.com/integration-system/net-mux v1.0.1 h1:UKHdt1UxNJXwroeLdhYQeUah/aizcqx6hS1SOdfx7pg=
|
||||
github.com/integration-system/net-mux v1.0.1/go.mod h1:0iEskyZB58/VwtFu8BATYMmPse2ZU9WWv6agidMEAs0=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
|
||||
@@ -165,7 +165,7 @@ func initRaft(listener net.Listener, clusterCfg conf.ClusterConfiguration,
|
||||
return nil, nil
|
||||
}
|
||||
clusterClient := cluster.NewRaftClusterClient(r, declaration, func(address string) {
|
||||
raftStore.VisitState(func(s state.WritableState) {
|
||||
go raftStore.VisitState(func(s state.WritableState) {
|
||||
cfg := config.Get().(*conf.Configuration)
|
||||
addr, err := net.ResolveTCPAddr("tcp", address)
|
||||
if err != nil {
|
||||
@@ -202,13 +202,14 @@ func initGrpc(bindAddress structure.AddressConfiguration, raftStore *store.Store
|
||||
|
||||
func gracefulShutdown() {
|
||||
const (
|
||||
gracefulTimeout = 3 * time.Second
|
||||
terminateTimeout = 4 * time.Second
|
||||
gracefulTimeout = 10 * time.Second
|
||||
terminateTimeout = 11 * time.Second
|
||||
)
|
||||
|
||||
quit := make(chan os.Signal, 1)
|
||||
signal.Notify(quit, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
log.Infof(0, "received signal '%s'", <-quit)
|
||||
signalsCh := make(chan os.Signal, 1)
|
||||
signal.Notify(signalsCh, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)
|
||||
sig := <-signalsCh
|
||||
log.Infof(0, "received signal '%s'", sig)
|
||||
|
||||
finishedCh := make(chan struct{})
|
||||
go func() {
|
||||
@@ -217,7 +218,7 @@ func gracefulShutdown() {
|
||||
log.Fatal(0, "exit timeout reached: terminating")
|
||||
case <-finishedCh:
|
||||
// ok
|
||||
case sig := <-quit:
|
||||
case sig := <-signalsCh:
|
||||
log.Fatalf(0, "received duplicate exit signal '%s': terminating", sig)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in new issue
Block a user