[MM-58355] Send invalidate cache message across the cluster so that websocket connections on other instances are invalidated correctly (#27204)

* [MM-58355] Send invalidate cache message across the cluster so that websocket connections on other instances are invalidated correctly

* Add suggestion to clear the session cache on the local node as well

* Force read from master DB when gettting channel members for websocket to avoid any DB sync issues

* PR feedback

* Missed generated files
Этот коммит содержится в:
Devin Binnie
2024-06-07 09:38:53 -04:00
коммит произвёл GitHub
родитель 91741a7fa4
Коммит f3e760008c
17 изменённых файлов: 55 добавлений и 57 удалений

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

@@ -3646,27 +3646,27 @@ func testChannelStoreGetChannels(t *testing.T, rctx request.CTX, ss store.Store)
require.Equal(t, o2.Id, list[1].Id, "missing channel")
require.Equal(t, o3.Id, list[2].Id, "missing channel")
ids, err := ss.Channel().GetAllChannelMembersForUser(m1.UserId, false, false)
ids, err := ss.Channel().GetAllChannelMembersForUser(rctx, m1.UserId, false, false)
require.NoError(t, err)
_, ok := ids[o1.Id]
require.True(t, ok, "missing channel")
ids2, err := ss.Channel().GetAllChannelMembersForUser(m1.UserId, true, false)
ids2, err := ss.Channel().GetAllChannelMembersForUser(rctx, m1.UserId, true, false)
require.NoError(t, err)
_, ok = ids2[o1.Id]
require.True(t, ok, "missing channel")
ids3, err := ss.Channel().GetAllChannelMembersForUser(m1.UserId, true, false)
ids3, err := ss.Channel().GetAllChannelMembersForUser(rctx, m1.UserId, true, false)
require.NoError(t, err)
_, ok = ids3[o1.Id]
require.True(t, ok, "missing channel")
ids4, err := ss.Channel().GetAllChannelMembersForUser(m1.UserId, true, true)
ids4, err := ss.Channel().GetAllChannelMembersForUser(rctx, m1.UserId, true, true)
require.NoError(t, err)
_, ok = ids4[o1.Id]
require.True(t, ok, "missing channel")
ids5, err := ss.Channel().GetAllChannelMembersForUser(model.NewId(), true, true)
ids5, err := ss.Channel().GetAllChannelMembersForUser(rctx, model.NewId(), true, true)
require.NoError(t, err)
require.True(t, len(ids5) == 0)

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

@@ -534,9 +534,9 @@ func (_m *ChannelStore) GetAllChannelMemberIdsByChannelId(id string) ([]string,
return r0, r1
}
// GetAllChannelMembersForUser provides a mock function with given fields: userID, allowFromCache, includeDeleted
func (_m *ChannelStore) GetAllChannelMembersForUser(userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error) {
ret := _m.Called(userID, allowFromCache, includeDeleted)
// GetAllChannelMembersForUser provides a mock function with given fields: ctx, userID, allowFromCache, includeDeleted
func (_m *ChannelStore) GetAllChannelMembersForUser(ctx request.CTX, userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error) {
ret := _m.Called(ctx, userID, allowFromCache, includeDeleted)
if len(ret) == 0 {
panic("no return value specified for GetAllChannelMembersForUser")
@@ -544,19 +544,19 @@ func (_m *ChannelStore) GetAllChannelMembersForUser(userID string, allowFromCach
var r0 map[string]string
var r1 error
if rf, ok := ret.Get(0).(func(string, bool, bool) (map[string]string, error)); ok {
return rf(userID, allowFromCache, includeDeleted)
if rf, ok := ret.Get(0).(func(request.CTX, string, bool, bool) (map[string]string, error)); ok {
return rf(ctx, userID, allowFromCache, includeDeleted)
}
if rf, ok := ret.Get(0).(func(string, bool, bool) map[string]string); ok {
r0 = rf(userID, allowFromCache, includeDeleted)
if rf, ok := ret.Get(0).(func(request.CTX, string, bool, bool) map[string]string); ok {
r0 = rf(ctx, userID, allowFromCache, includeDeleted)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]string)
}
}
if rf, ok := ret.Get(1).(func(string, bool, bool) error); ok {
r1 = rf(userID, allowFromCache, includeDeleted)
if rf, ok := ret.Get(1).(func(request.CTX, string, bool, bool) error); ok {
r1 = rf(ctx, userID, allowFromCache, includeDeleted)
} else {
r1 = ret.Error(1)
}

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

@@ -479,9 +479,9 @@ func (_m *UserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.Use
return r0, r1
}
// GetAllProfilesInChannel provides a mock function with given fields: ctx, channelID, allowFromCache
func (_m *UserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) {
ret := _m.Called(ctx, channelID, allowFromCache)
// GetAllProfilesInChannel provides a mock function with given fields: rctx, channelID, allowFromCache
func (_m *UserStore) GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) {
ret := _m.Called(rctx, channelID, allowFromCache)
if len(ret) == 0 {
panic("no return value specified for GetAllProfilesInChannel")
@@ -490,10 +490,10 @@ func (_m *UserStore) GetAllProfilesInChannel(ctx context.Context, channelID stri
var r0 map[string]*model.User
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, bool) (map[string]*model.User, error)); ok {
return rf(ctx, channelID, allowFromCache)
return rf(rctx, channelID, allowFromCache)
}
if rf, ok := ret.Get(0).(func(context.Context, string, bool) map[string]*model.User); ok {
r0 = rf(ctx, channelID, allowFromCache)
r0 = rf(rctx, channelID, allowFromCache)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]*model.User)
@@ -501,7 +501,7 @@ func (_m *UserStore) GetAllProfilesInChannel(ctx context.Context, channelID stri
}
if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok {
r1 = rf(ctx, channelID, allowFromCache)
r1 = rf(rctx, channelID, allowFromCache)
} else {
r1 = ret.Error(1)
}