MM-60171: Using a generic function to allocate values (#28245)
We sprinkle a bit of generic magic to refactor a lot of duplicate code. To avoid exposing unnecessary code, I duplicated the function twice. But let me know if you have strong opinions about this. https://mattermost.atlassian.net/browse/MM-60171 ```release-note NONE ``` --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e0e0b57b8b
Коммит
9447cb9074
@@ -63,14 +63,9 @@ func (ps *PlatformService) ClearUserSessionCacheLocal(userID string) {
|
||||
return nil
|
||||
}
|
||||
|
||||
toPass := make([]any, 0, len(keys))
|
||||
for i := 0; i < len(keys); i++ {
|
||||
// This always needs to be a pointer to a value.
|
||||
// Otherwise the msp unmarshaler will fail to work.
|
||||
var session model.Session
|
||||
toPass = append(toPass, &session)
|
||||
}
|
||||
|
||||
// This always needs to be model.Session, not *model.Session.
|
||||
// Otherwise the msp unmarshaler will fail to work.
|
||||
toPass := allocateCacheTargets[model.Session](len(keys))
|
||||
errs := ps.sessionCache.GetMulti(keys, toPass)
|
||||
for i, err := range errs {
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user