From 0482b57bf80dfa1e8e7ae1e3fd908933a3852fe0 Mon Sep 17 00:00:00 2001 From: Yahya Haq <64690363+YahyaHaq@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:39:50 +0500 Subject: [PATCH] [MM-29441] Fix errcheck issues in web_hub.go (#29614) * fix errcheck for web_hub.go * log user id --- server/.golangci.yml | 1 - server/channels/app/platform/web_hub.go | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index f6af94764c..d6687c04b4 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -96,7 +96,6 @@ issues: channels/app/platform/session.go|\ channels/app/platform/status.go|\ channels/app/platform/web_broadcast_hook.go|\ - channels/app/platform/web_hub.go|\ channels/app/platform/web_hub_test.go|\ channels/app/plugin_test.go|\ channels/app/post_helpers_test.go|\ diff --git a/server/channels/app/platform/web_hub.go b/server/channels/app/platform/web_hub.go index a73f611067..2bc13bc70a 100644 --- a/server/channels/app/platform/web_hub.go +++ b/server/channels/app/platform/web_hub.go @@ -150,7 +150,10 @@ func (ps *PlatformService) GetHubForUserId(userID string) *Hub { // https://mattermost.atlassian.net/browse/MM-26629. var hash maphash.Hash hash.SetSeed(ps.hashSeed) - hash.Write([]byte(userID)) + _, err := hash.Write([]byte(userID)) + if err != nil { + ps.logger.Error("Unable to write userID to hash", mlog.String("userID", userID), mlog.Err(err)) + } index := hash.Sum64() % uint64(len(ps.hubs)) return ps.hubs[int(index)]