Merge branch 'graceful_fix' into 'master'

fixed graceful shutdown

See merge request msp2.0/msp-admin-service!4
This commit is contained in:
Мержанов Максим Владимирович committed 2021-02-08 12:11:41 +03:00
commit f5ab9c768f
2 files changed
+3 -7

No files matched your search

+2 -2
View File
@@ -53,9 +53,9 @@ func socketConfiguration(cfg interface{}) structure.SocketConfiguration {
}
}
func onShutdown(_ context.Context, _ os.Signal) {
func onShutdown(ctx context.Context, _ os.Signal) {
service.SessionManager.ShutdownSocket(ctx)
backend.StopGrpcServer()
service.SessionManager.ShutdownSocket()
closeListeners(wsLn, grpcLn)
}
+1 -5
View File
@@ -6,7 +6,6 @@ import (
"net"
"net/http"
"sync"
"time"
etp "github.com/integration-system/isp-etp-go/v2"
"github.com/integration-system/isp-lib/v2/structure"
@@ -207,10 +206,7 @@ func (s *sessionManager) InitWebSocket(ln net.Listener) {
}()
}
func (s *sessionManager) ShutdownSocket() {
ctx, cancel := context.WithTimeout(context.TODO(), 5*time.Second)
defer cancel()
func (s *sessionManager) ShutdownSocket(ctx context.Context) {
if err := s.httpServer.Shutdown(ctx); err != nil {
log.Errorf(44, "Unable to shutdown http server. err: %v", err)
}