forked from forgejo/forgejo
Fix nil checking on typed interface (#17598)
* Fix nil checking on typed interface - Partially resoles #17596 - Resolves SA4023 errors. - Ensure correctly that typed interface are nil. * Remove unnecessary code `NewBleveIndexer` will never return nil, even on errors. * Patch `NewBleveIndexer` * Fix low-level functions * Remove deadcode * Fix GetSession * Close Elastic search when err isn't nil * Update elastic_search.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
253d9e4158
commit
ab1379743e
4 changed files with 8 additions and 15 deletions
|
@ -185,9 +185,6 @@ func Init() {
|
|||
|
||||
rIndexer, populate, err = NewBleveIndexer(setting.Indexer.RepoPath)
|
||||
if err != nil {
|
||||
if rIndexer != nil {
|
||||
rIndexer.Close()
|
||||
}
|
||||
cancel()
|
||||
indexer.Close()
|
||||
close(waitChannel)
|
||||
|
@ -205,9 +202,6 @@ func Init() {
|
|||
|
||||
rIndexer, populate, err = NewElasticSearchIndexer(setting.Indexer.RepoConnStr, setting.Indexer.RepoIndexerName)
|
||||
if err != nil {
|
||||
if rIndexer != nil {
|
||||
rIndexer.Close()
|
||||
}
|
||||
cancel()
|
||||
indexer.Close()
|
||||
close(waitChannel)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue