summaryrefslogtreecommitdiffstats
path: root/app/server.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-10-09 14:59:48 -0700
committerGitHub <noreply@github.com>2017-10-09 14:59:48 -0700
commitbff2b5e735ae7fc80157b4108ddbe56be8acb752 (patch)
tree14867d2bff71b6b638b0b358b1f38eb062cb597f /app/server.go
parent0f66b6e72621842467d0e368b95ee58f485d4ace (diff)
downloadchat-bff2b5e735ae7fc80157b4108ddbe56be8acb752.tar.gz
chat-bff2b5e735ae7fc80157b4108ddbe56be8acb752.tar.bz2
chat-bff2b5e735ae7fc80157b4108ddbe56be8acb752.zip
Miscellaneous app cleanup (#7594)
* app cleanup * whoops, forgot a file * some minor cleanup * longer container deadline * defensive checks
Diffstat (limited to 'app/server.go')
-rw-r--r--app/server.go19
1 files changed, 8 insertions, 11 deletions
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
+ }
+}