use defer to make sure we always release session data

This commit is contained in:
bergquist
2019-01-24 13:48:36 +01:00
parent fd0f9f2dd2
commit 9ae306e417
2 changed files with 8 additions and 5 deletions
+2 -1
View File
@@ -65,6 +65,8 @@ func (hs *HTTPServer) Init() error {
hs.macaron = hs.newMacaron()
hs.registerRoutes()
session.Init(&setting.SessionOptions, setting.SessionConnMaxLifetime)
return nil
}
@@ -225,7 +227,6 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
m.Use(hs.metricsEndpoint)
m.Use(middleware.GetContextHandler(hs.AuthTokenService))
m.Use(middleware.OrgRedirect())
session.Init(&setting.SessionOptions, setting.SessionConnMaxLifetime)
// needs to be after context handler
if setting.EnforceDomain {