[MM-61761] Fix errcheck issues in channels/app/platform/cluster_handlers.go (#29302)

* Fixed errcheck issues

* fixed issues

* fixed issues

* Fix merge conflict

* fix code
Этот коммит содержится в:
Seiya Homma
2024-11-22 16:10:26 +09:00
коммит произвёл GitHub
родитель 3b1eb64e02
Коммит 5234b6897e
2 изменённых файлов: 13 добавлений и 8 удалений

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

@@ -98,7 +98,6 @@ issues:
channels/app/migrations.go|\ channels/app/migrations.go|\
channels/app/permissions.go|\ channels/app/permissions.go|\
channels/app/permissions_test.go|\ channels/app/permissions_test.go|\
channels/app/platform/cluster_handlers.go|\
channels/app/platform/helper_test.go|\ channels/app/platform/helper_test.go|\
channels/app/platform/license.go|\ channels/app/platform/license.go|\
channels/app/platform/link_cache.go|\ channels/app/platform/link_cache.go|\

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

@@ -56,11 +56,13 @@ func (ps *PlatformService) ClusterPublishHandler(msg *model.ClusterMessage) {
func (ps *PlatformService) ClusterUpdateStatusHandler(msg *model.ClusterMessage) { func (ps *PlatformService) ClusterUpdateStatusHandler(msg *model.ClusterMessage) {
var status model.Status var status model.Status
if jsonErr := json.Unmarshal(msg.Data, &status); jsonErr != nil { if err := json.Unmarshal(msg.Data, &status); err != nil {
ps.logger.Warn("Failed to decode status from JSON") ps.logger.Warn("Failed to decode status from JSON", mlog.Err(err))
} }
ps.statusCache.SetWithDefaultExpiry(status.UserId, status) if err := ps.statusCache.SetWithDefaultExpiry(status.UserId, status); err != nil {
ps.logger.Warn("Failed to store the status in the cache", mlog.String("user_id", status.UserId), mlog.Err(err))
}
} }
func (ps *PlatformService) ClusterInvalidateAllCachesHandler(msg *model.ClusterMessage) { func (ps *PlatformService) ClusterInvalidateAllCachesHandler(msg *model.ClusterMessage) {
@@ -91,8 +93,8 @@ func (ps *PlatformService) clusterClearSessionCacheForAllUsersHandler(msg *model
func (ps *PlatformService) clusterBusyStateChgHandler(msg *model.ClusterMessage) { func (ps *PlatformService) clusterBusyStateChgHandler(msg *model.ClusterMessage) {
var sbs model.ServerBusyState var sbs model.ServerBusyState
if jsonErr := json.Unmarshal(msg.Data, &sbs); jsonErr != nil { if err := json.Unmarshal(msg.Data, &sbs); err != nil {
mlog.Warn("Failed to decode server busy state from JSON", mlog.Err(jsonErr)) ps.logger.Warn("Failed to decode server busy state from JSON", mlog.Err(err))
} }
ps.Busy.ClusterEventChanged(&sbs) ps.Busy.ClusterEventChanged(&sbs)
@@ -113,7 +115,9 @@ func (ps *PlatformService) invalidateWebConnSessionCacheForUserSkipClusterSend(u
func (ps *PlatformService) InvalidateAllCachesSkipSend() { func (ps *PlatformService) InvalidateAllCachesSkipSend() {
ps.logger.Info("Purging all caches") ps.logger.Info("Purging all caches")
ps.ClearAllUsersSessionCacheLocal() ps.ClearAllUsersSessionCacheLocal()
ps.statusCache.Purge() if err := ps.statusCache.Purge(); err != nil {
ps.logger.Warn("Failed to clear the status cache", mlog.Err(err))
}
ps.Store.Team().ClearCaches() ps.Store.Team().ClearCaches()
ps.Store.Channel().ClearCaches() ps.Store.Channel().ClearCaches()
ps.Store.User().ClearCaches() ps.Store.User().ClearCaches()
@@ -121,7 +125,9 @@ func (ps *PlatformService) InvalidateAllCachesSkipSend() {
ps.Store.FileInfo().ClearCaches() ps.Store.FileInfo().ClearCaches()
ps.Store.Webhook().ClearCaches() ps.Store.Webhook().ClearCaches()
linkCache.Purge() if err := linkCache.Purge(); err != nil {
ps.logger.Warn("Failed to clear the link cache", mlog.Err(err))
}
ps.LoadLicense() ps.LoadLicense()
} }