mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixing clustering problem (#4320)
This commit is contained in:
committed by
Christopher Speller
parent
57eb69927c
commit
3e1fc76bf9
@@ -474,6 +474,14 @@ func GetSession(token string) *model.Session {
|
||||
|
||||
func RemoveAllSessionsForUserId(userId string) {
|
||||
|
||||
RemoveAllSessionsForUserIdSkipClusterSend(userId)
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
einterfaces.GetClusterInterface().RemoveAllSessionsForUserId(userId)
|
||||
}
|
||||
}
|
||||
|
||||
func RemoveAllSessionsForUserIdSkipClusterSend(userId string) {
|
||||
keys := sessionCache.Keys()
|
||||
|
||||
for _, key := range keys {
|
||||
@@ -485,9 +493,6 @@ func RemoveAllSessionsForUserId(userId string) {
|
||||
}
|
||||
}
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
einterfaces.GetClusterInterface().RemoveAllSessionsForUserId(userId)
|
||||
}
|
||||
}
|
||||
|
||||
func AddSessionToCache(session *model.Session) {
|
||||
|
||||
@@ -101,30 +101,19 @@ func PublishSkipClusterSend(message *model.WebSocketEvent) {
|
||||
}
|
||||
|
||||
func InvalidateCacheForUser(userId string) {
|
||||
|
||||
Srv.Store.Channel().InvalidateAllChannelMembersForUser(userId)
|
||||
|
||||
for _, hub := range hubs {
|
||||
hub.InvalidateUser(userId)
|
||||
}
|
||||
InvalidateCacheForUserSkipClusterSend(userId)
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
einterfaces.GetClusterInterface().InvalidateCacheForUser(userId)
|
||||
}
|
||||
}
|
||||
|
||||
func InvalidateCacheForChannel(channelId string) {
|
||||
func InvalidateCacheForUserSkipClusterSend(userId string) {
|
||||
Srv.Store.Channel().InvalidateAllChannelMembersForUser(userId)
|
||||
|
||||
// XXX TODO FIX ME
|
||||
// This can be removed, but the performance branch
|
||||
// needs to be merged into master so it can be removed
|
||||
// from the enterprise repo as well.
|
||||
|
||||
// hub.invalidateChannel <- channelId
|
||||
|
||||
// if einterfaces.GetClusterInterface() != nil {
|
||||
// einterfaces.GetClusterInterface().InvalidateCacheForChannel(channelId)
|
||||
// }
|
||||
for _, hub := range hubs {
|
||||
hub.InvalidateUser(userId)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Hub) Register(webConn *WebConn) {
|
||||
|
||||
@@ -13,7 +13,6 @@ type ClusterInterface interface {
|
||||
GetClusterInfos() []*model.ClusterInfo
|
||||
RemoveAllSessionsForUserId(userId string)
|
||||
InvalidateCacheForUser(userId string)
|
||||
InvalidateCacheForChannel(channelId string)
|
||||
Publish(event *model.WebSocketEvent)
|
||||
UpdateStatus(status *model.Status)
|
||||
GetLogs() ([]string, *model.AppError)
|
||||
|
||||
Reference in New Issue
Block a user