From bff2b5e735ae7fc80157b4108ddbe56be8acb752 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 9 Oct 2017 14:59:48 -0700 Subject: Miscellaneous app cleanup (#7594) * app cleanup * whoops, forgot a file * some minor cleanup * longer container deadline * defensive checks --- app/server.go | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'app/server.go') diff --git a/app/server.go b/app/server.go index 8b09bfef0..3802c2eec 100644 --- a/app/server.go +++ b/app/server.go @@ -20,7 +20,6 @@ import ( "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/store" - "github.com/mattermost/mattermost-server/store/sqlstore" "github.com/mattermost/mattermost-server/utils" ) @@ -78,16 +77,6 @@ func (cw *CorsWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request) { const TIME_TO_WAIT_FOR_CONNECTIONS_TO_CLOSE_ON_SERVER_SHUTDOWN = time.Second -func (a *App) NewServer() { - l4g.Info(utils.T("api.server.new_server.init.info")) - - a.Srv = &Server{} -} - -func (a *App) InitStores() { - a.Srv.Store = store.NewLayeredStore(sqlstore.NewSqlSupplier(utils.Cfg.SqlSettings, a.Metrics), a.Metrics, a.Cluster) -} - type VaryBy struct{} func (m *VaryBy) Key(r *http.Request) string { @@ -211,3 +200,11 @@ func (a *App) StartServer() { } }() } + +func (a *App) StopServer() { + if a.Srv.GracefulServer != nil { + a.Srv.GracefulServer.Stop(TIME_TO_WAIT_FOR_CONNECTIONS_TO_CLOSE_ON_SERVER_SHUTDOWN) + <-a.Srv.GracefulServer.StopChan() + a.Srv.GracefulServer = nil + } +} -- cgit v1.2.3-1-g7c22