* app cleanup

* whoops, forgot a file

* some minor cleanup

* longer container deadline

* defensive checks
Этот коммит содержится в:
Chris
2017-10-09 14:59:48 -07:00
коммит произвёл GitHub
родитель 0f66b6e726
Коммит bff2b5e735
22 изменённых файлов: 165 добавлений и 166 удалений

Просмотреть файл

@@ -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
}
}