Skip to content

Commit

Permalink
Fix panic if there is a plugin configuration error in the server (spi…
Browse files Browse the repository at this point in the history
…ffe#3166)

Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
  • Loading branch information
amartinezfayo authored and stevend-uber committed Oct 13, 2023
1 parent 568e561 commit 7f6e828
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions pkg/server/catalog/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,22 @@ func (repo *Repository) Services() []catalog.ServiceRepo {
func (repo *Repository) Close() {
// Must close in reverse initialization order!

repo.log.Debug("Closing catalog")
if err := repo.catalogCloser.Close(); err == nil {
repo.log.Info("Catalog closed")
} else {
repo.log.WithError(err).Error("Failed to close catalog")
if repo.catalogCloser != nil {
repo.log.Debug("Closing catalog")
if err := repo.catalogCloser.Close(); err == nil {
repo.log.Info("Catalog closed")
} else {
repo.log.WithError(err).Error("Failed to close catalog")
}
}

repo.log.Debug("Closing DataStore")
if err := repo.dataStoreCloser.Close(); err == nil {
repo.log.Info("DataStore closed")
} else {
repo.log.WithError(err).Error("Failed to close DataStore")
if repo.dataStoreCloser != nil {
repo.log.Debug("Closing DataStore")
if err := repo.dataStoreCloser.Close(); err == nil {
repo.log.Info("DataStore closed")
} else {
repo.log.WithError(err).Error("Failed to close DataStore")
}
}
}

Expand Down

0 comments on commit 7f6e828

Please sign in to comment.