From 2c32040e2e8113ab8903ce1f63659bc98c9f0eb2 Mon Sep 17 00:00:00 2001 From: AulakhHarsh <115346020+AulakhHarsh@users.noreply.github.com> Date: Thu, 28 Nov 2024 14:47:33 +0530 Subject: [PATCH] [MM-61769] Fix errcheck for /platform/searchengine.go (#29341) Co-authored-by: Ben Schumacher --- server/.golangci.yml | 1 - server/channels/app/platform/searchengine.go | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/server/.golangci.yml b/server/.golangci.yml index 4a43304415c..e6ba333d667 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -99,7 +99,6 @@ issues: channels/app/permissions_test.go|\ channels/app/platform/helper_test.go|\ channels/app/platform/license.go|\ - channels/app/platform/searchengine.go|\ channels/app/platform/service.go|\ channels/app/platform/service_test.go|\ channels/app/platform/session.go|\ diff --git a/server/channels/app/platform/searchengine.go b/server/channels/app/platform/searchengine.go index 67668e9d667..c4499c279e6 100644 --- a/server/channels/app/platform/searchengine.go +++ b/server/channels/app/platform/searchengine.go @@ -5,6 +5,7 @@ package platform import ( "github.com/mattermost/mattermost/server/public/model" + "github.com/mattermost/mattermost/server/public/shared/mlog" ) func (ps *PlatformService) StartSearchEngine() (string, string) { @@ -20,7 +21,10 @@ func (ps *PlatformService) StartSearchEngine() (string, string) { if ps.SearchEngine == nil { return } - ps.SearchEngine.UpdateConfig(newConfig) + + if err := ps.SearchEngine.UpdateConfig(newConfig); err != nil { + ps.Log().Error("Failed to update search engine config", mlog.Err(err)) + } if ps.SearchEngine.ElasticsearchEngine != nil && !*oldConfig.ElasticsearchSettings.EnableIndexing && *newConfig.ElasticsearchSettings.EnableIndexing { ps.Go(func() { @@ -78,9 +82,13 @@ func (ps *PlatformService) StopSearchEngine() { ps.RemoveConfigListener(ps.searchConfigListenerId) ps.RemoveLicenseListener(ps.searchLicenseListenerId) if ps.SearchEngine != nil && ps.SearchEngine.ElasticsearchEngine != nil && ps.SearchEngine.ElasticsearchEngine.IsActive() { - ps.SearchEngine.ElasticsearchEngine.Stop() + if err := ps.SearchEngine.ElasticsearchEngine.Stop(); err != nil { + ps.Log().Error("Failed to stop Elasticsearch engine", mlog.Err(err)) + } } if ps.SearchEngine != nil && ps.SearchEngine.BleveEngine != nil && ps.SearchEngine.BleveEngine.IsActive() { - ps.SearchEngine.BleveEngine.Stop() + if err := ps.SearchEngine.BleveEngine.Stop(); err != nil { + ps.Log().Error("Failed to stop Bleve Engine", mlog.Err(err)) + } } }