MM-31326: Fix Striped LRU to have minimum of 1 bucket (#16531)
* MM-31326: Fix Striped LRU to have minimum of 1 bucket https://mattermost.atlassian.net/browse/MM-31236 ```release-note NONE ``` * Using a maxInt function
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1fe003aa36
Коммит
44eb3e3f97
@@ -133,7 +133,7 @@ func NewLocalCacheLayer(baseStore store.Store, metrics einterfaces.MetricsInterf
|
||||
DefaultExpiry: ROLE_CACHE_SEC * time.Second,
|
||||
InvalidateClusterEvent: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES,
|
||||
Striped: true,
|
||||
StripedBuckets: runtime.NumCPU() - 1,
|
||||
StripedBuckets: maxInt(runtime.NumCPU()-1, 1),
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -271,7 +271,7 @@ func NewLocalCacheLayer(baseStore store.Store, metrics einterfaces.MetricsInterf
|
||||
DefaultExpiry: USER_PROFILE_BY_ID_SEC * time.Second,
|
||||
InvalidateClusterEvent: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_PROFILE_BY_IDS,
|
||||
Striped: true,
|
||||
StripedBuckets: runtime.NumCPU() - 1,
|
||||
StripedBuckets: maxInt(runtime.NumCPU()-1, 1),
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -319,6 +319,13 @@ func NewLocalCacheLayer(baseStore store.Store, metrics einterfaces.MetricsInterf
|
||||
return
|
||||
}
|
||||
|
||||
func maxInt(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (s LocalCacheStore) Reaction() store.ReactionStore {
|
||||
return s.reaction
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user