Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic if there is a plugin configuration error in the server #3166

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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