Skip to content

Commit

Permalink
[MM-61769] Fix errcheck for /platform/searchengine.go (mattermost#29341)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Schumacher <[email protected]>
  • Loading branch information
AulakhHarsh and hanzei authored Nov 28, 2024
1 parent dabf383 commit 2c32040
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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|\
Expand Down
14 changes: 11 additions & 3 deletions server/channels/app/platform/searchengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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() {
Expand Down Expand Up @@ -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))
}
}
}

0 comments on commit 2c32040

Please sign in to comment.