mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-56878: Remove unused store method (#26230)
IsUserInChannelUseCache wasn't being used anywhere. https://mattermost.atlassian.net/browse/MM-56878 ```release-note NONE ```
This commit is contained in:
parent
de3e5aab25
commit
f3c7510c70
@ -2059,19 +2059,6 @@ func (s *OpenTracingLayerChannelStore) InvalidatePinnedPostCount(channelID strin
|
||||
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.IsUserInChannelUseCache")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
defer func() {
|
||||
s.Root.Store.SetContext(origCtx)
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result := s.ChannelStore.IsUserInChannelUseCache(userID, channelID)
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.MigrateChannelMembers")
|
||||
|
@ -2252,12 +2252,6 @@ func (s *RetryLayerChannelStore) InvalidatePinnedPostCount(channelID string) {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool {
|
||||
|
||||
return s.ChannelStore.IsUserInChannelUseCache(userID, channelID)
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) {
|
||||
|
||||
tries := 0
|
||||
|
@ -17,7 +17,6 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/store"
|
||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||
@ -2164,35 +2163,6 @@ func (s SqlChannelStore) InvalidateAllChannelMembersForUser(userId string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) IsUserInChannelUseCache(userId string, channelId string) bool {
|
||||
var ids map[string]string
|
||||
if err := allChannelMembersForUserCache.Get(userId, &ids); err == nil {
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheHitCounter("All Channel Members for User")
|
||||
}
|
||||
if _, ok := ids[channelId]; ok {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if s.metrics != nil {
|
||||
s.metrics.IncrementMemCacheMissCounter("All Channel Members for User")
|
||||
}
|
||||
|
||||
ids, err := s.GetAllChannelMembersForUser(userId, true, false)
|
||||
if err != nil {
|
||||
mlog.Error("Error getting all channel members for user", mlog.Err(err))
|
||||
return false
|
||||
}
|
||||
|
||||
if _, ok := ids[channelId]; ok {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetMemberForPost(postId string, userId string, includeArchivedChannels bool) (*model.ChannelMember, error) {
|
||||
var dbMember channelMemberWithSchemeRoles
|
||||
query := `
|
||||
|
@ -232,7 +232,6 @@ type ChannelStore interface {
|
||||
GetAllChannelMembersForUser(userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error)
|
||||
GetChannelsMemberCount(channelIDs []string) (map[string]int64, error)
|
||||
InvalidateAllChannelMembersForUser(userID string)
|
||||
IsUserInChannelUseCache(userID string, channelID string) bool
|
||||
GetAllChannelMembersNotifyPropsForChannel(channelID string, allowFromCache bool) (map[string]model.StringMap, error)
|
||||
InvalidateCacheForChannelMembersNotifyProps(channelID string)
|
||||
GetMemberForPost(postID string, userID string, includeArchivedChannels bool) (*model.ChannelMember, error)
|
||||
|
@ -3737,25 +3737,6 @@ func testChannelStoreGetChannels(t *testing.T, rctx request.CTX, ss store.Store)
|
||||
require.Equal(t, o1.Id, list[0].Id, "missing channel")
|
||||
require.Equal(t, o3.Id, list[1].Id, "missing channel")
|
||||
|
||||
require.True(
|
||||
t,
|
||||
ss.Channel().IsUserInChannelUseCache(m1.UserId, o1.Id),
|
||||
"missing channel")
|
||||
require.True(
|
||||
t,
|
||||
ss.Channel().IsUserInChannelUseCache(m1.UserId, o2.Id),
|
||||
"missing channel")
|
||||
|
||||
require.False(
|
||||
t,
|
||||
ss.Channel().IsUserInChannelUseCache(m1.UserId, "blahblah"),
|
||||
"missing channel")
|
||||
|
||||
require.False(
|
||||
t,
|
||||
ss.Channel().IsUserInChannelUseCache("blahblah", "blahblah"),
|
||||
"missing channel")
|
||||
|
||||
ss.Channel().InvalidateAllChannelMembersForUser(m1.UserId)
|
||||
}
|
||||
|
||||
|
@ -1903,20 +1903,6 @@ func (_m *ChannelStore) InvalidatePinnedPostCount(channelID string) {
|
||||
_m.Called(channelID)
|
||||
}
|
||||
|
||||
// IsUserInChannelUseCache provides a mock function with given fields: userID, channelID
|
||||
func (_m *ChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool {
|
||||
ret := _m.Called(userID, channelID)
|
||||
|
||||
var r0 bool
|
||||
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
|
||||
r0 = rf(userID, channelID)
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MigrateChannelMembers provides a mock function with given fields: fromChannelID, fromUserID
|
||||
func (_m *ChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) {
|
||||
ret := _m.Called(fromChannelID, fromUserID)
|
||||
|
@ -1918,22 +1918,6 @@ func (s *TimerLayerChannelStore) InvalidatePinnedPostCount(channelID string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool {
|
||||
start := time.Now()
|
||||
|
||||
result := s.ChannelStore.IsUserInChannelUseCache(userID, channelID)
|
||||
|
||||
elapsed := float64(time.Since(start)) / float64(time.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
success := "false"
|
||||
if true {
|
||||
success = "true"
|
||||
}
|
||||
s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.IsUserInChannelUseCache", success, elapsed)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *TimerLayerChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) {
|
||||
start := time.Now()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user