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
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
ac90f5b389
Коммит
59d971dc75
@@ -7,11 +7,23 @@ import (
|
||||
"net/http"
|
||||
|
||||
l4g "github.com/alecthomas/log4go"
|
||||
|
||||
"github.com/mattermost/platform/einterfaces"
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/store"
|
||||
"github.com/mattermost/platform/utils"
|
||||
)
|
||||
|
||||
var statusCache *utils.Cache = utils.NewLru(model.STATUS_CACHE_SIZE)
|
||||
|
||||
func AddStatusCache(status *model.Status) {
|
||||
statusCache.Add(status.UserId, status)
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
einterfaces.GetClusterInterface().UpdateStatus(status)
|
||||
}
|
||||
}
|
||||
|
||||
func InitStatus() {
|
||||
l4g.Debug(utils.T("api.status.init.debug"))
|
||||
|
||||
@@ -69,7 +81,7 @@ func SetStatusOnline(userId string, sessionId string) {
|
||||
status.LastActivityAt = model.GetMillis()
|
||||
}
|
||||
|
||||
statusCache.Add(status.UserId, status)
|
||||
AddStatusCache(status)
|
||||
|
||||
achan := Srv.Store.Session().UpdateLastActivityAt(sessionId, model.GetMillis())
|
||||
|
||||
@@ -98,7 +110,7 @@ func SetStatusOnline(userId string, sessionId string) {
|
||||
func SetStatusOffline(userId string) {
|
||||
status := &model.Status{userId, model.STATUS_OFFLINE, model.GetMillis()}
|
||||
|
||||
statusCache.Add(status.UserId, status)
|
||||
AddStatusCache(status)
|
||||
|
||||
if result := <-Srv.Store.Status().SaveOrUpdate(status); result.Err != nil {
|
||||
l4g.Error(utils.T("api.status.save_status.error"), userId, result.Err)
|
||||
@@ -125,7 +137,7 @@ func SetStatusAwayIfNeeded(userId string) {
|
||||
|
||||
status.Status = model.STATUS_AWAY
|
||||
|
||||
statusCache.Add(status.UserId, status)
|
||||
AddStatusCache(status)
|
||||
|
||||
if result := <-Srv.Store.Status().SaveOrUpdate(status); result.Err != nil {
|
||||
l4g.Error(utils.T("api.status.save_status.error"), userId, result.Err)
|
||||
|
||||
Ссылка в новой задаче
Block a user