diff --git a/server/.golangci.yml b/server/.golangci.yml index 3dacd465af..5759d13f48 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -98,7 +98,6 @@ issues: channels/app/migrations.go|\ channels/app/permissions.go|\ channels/app/permissions_test.go|\ - channels/app/platform/cluster_handlers.go|\ channels/app/platform/helper_test.go|\ channels/app/platform/license.go|\ channels/app/platform/link_cache.go|\ diff --git a/server/channels/app/platform/cluster_handlers.go b/server/channels/app/platform/cluster_handlers.go index afe23d6622..ae36e28889 100644 --- a/server/channels/app/platform/cluster_handlers.go +++ b/server/channels/app/platform/cluster_handlers.go @@ -56,11 +56,13 @@ func (ps *PlatformService) ClusterPublishHandler(msg *model.ClusterMessage) { func (ps *PlatformService) ClusterUpdateStatusHandler(msg *model.ClusterMessage) { var status model.Status - if jsonErr := json.Unmarshal(msg.Data, &status); jsonErr != nil { - ps.logger.Warn("Failed to decode status from JSON") + if err := json.Unmarshal(msg.Data, &status); err != nil { + 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) { @@ -91,8 +93,8 @@ func (ps *PlatformService) clusterClearSessionCacheForAllUsersHandler(msg *model func (ps *PlatformService) clusterBusyStateChgHandler(msg *model.ClusterMessage) { var sbs model.ServerBusyState - if jsonErr := json.Unmarshal(msg.Data, &sbs); jsonErr != nil { - mlog.Warn("Failed to decode server busy state from JSON", mlog.Err(jsonErr)) + if err := json.Unmarshal(msg.Data, &sbs); err != nil { + ps.logger.Warn("Failed to decode server busy state from JSON", mlog.Err(err)) } ps.Busy.ClusterEventChanged(&sbs) @@ -113,7 +115,9 @@ func (ps *PlatformService) invalidateWebConnSessionCacheForUserSkipClusterSend(u func (ps *PlatformService) InvalidateAllCachesSkipSend() { ps.logger.Info("Purging all caches") 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.Channel().ClearCaches() ps.Store.User().ClearCaches() @@ -121,7 +125,9 @@ func (ps *PlatformService) InvalidateAllCachesSkipSend() { ps.Store.FileInfo().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() }