Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/indexer/code/bleve.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ func NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error) {
indexDir: indexDir,
}
created, err := indexer.init()
if err != nil {
indexer.Close()
return nil, false, err
}
return indexer, created, err
}

Expand Down
5 changes: 4 additions & 1 deletion modules/indexer/code/elastic_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ func NewElasticSearchIndexer(url, indexerName string) (*ElasticSearchIndexer, bo
indexerAliasName: indexerName,
}
exists, err := indexer.init()

if err != nil {
indexer.Close()
return nil, false, err
}
return indexer, !exists, err
}

Expand Down
6 changes: 0 additions & 6 deletions modules/indexer/code/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 0 additions & 8 deletions routers/web/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ func Recovery() func(next http.Handler) http.Handler {
log.Error("%v", combinedErr)

sessionStore := session.GetSession(req)
if sessionStore == nil {
if setting.IsProd {
http.Error(w, http.StatusText(500), 500)
} else {
http.Error(w, combinedErr, 500)
}
return
}

var lc = middleware.Locale(w, req)
var store = dataStore{
Expand Down