summaryrefslogtreecommitdiffstats
path: root/app/server.go
diff options
context:
space:
mode:
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
+ }
+}