From 59d971dc751b0414c5b38c9df4b552e45f5641be Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Thu, 4 Aug 2016 09:25:37 -0800 Subject: PLT-2899 adding clustering of app servers (#3682) * PLT-2899 adding clustering of app servers * PLT-2899 base framework * PLT-2899 HA backend * PLT-2899 Fixing config file * PLT-2899 adding config syncing * PLT-2899 set System console to readonly when clustering enabled. * PLT-2899 Fixing publish API * PLT-2899 fixing strings --- api/context.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'api/context.go') diff --git a/api/context.go b/api/context.go index 9a2f9b9ea..08f41aa6d 100644 --- a/api/context.go +++ b/api/context.go @@ -14,13 +14,13 @@ import ( "github.com/gorilla/mux" goi18n "github.com/nicksnyder/go-i18n/i18n" + "github.com/mattermost/platform/einterfaces" "github.com/mattermost/platform/model" "github.com/mattermost/platform/store" "github.com/mattermost/platform/utils" ) var sessionCache *utils.Cache = utils.NewLru(model.SESSION_CACHE_SIZE) -var statusCache *utils.Cache = utils.NewLru(model.STATUS_CACHE_SIZE) var allowedMethods []string = []string{ "POST", @@ -148,7 +148,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId) - w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v", model.CurrentVersion, utils.CfgLastModified)) + w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v", model.CurrentVersion, utils.CfgHash)) + if einterfaces.GetClusterInterface() != nil { + w.Header().Set(model.HEADER_CLUSTER_ID, einterfaces.GetClusterInterface().GetClusterId()) + } // Instruct the browser not to display us in an iframe unless is the same origin for anti-clickjacking if !h.isApi { @@ -554,6 +557,10 @@ func RemoveAllSessionsForUserId(userId string) { } } } + + if einterfaces.GetClusterInterface() != nil { + einterfaces.GetClusterInterface().RemoveAllSessionsForUserId(userId) + } } func AddSessionToCache(session *model.Session) { -- cgit v1.2.3-1-g7c22