Additional Config Store Cleanup (#16440)
This change addresses a few issues where config stores were not properly closed when an error was encountered on server startup. This could result in leaked database connections when dealing with a database config store.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9283143c3b
Коммит
fe7d9f7643
@@ -54,7 +54,13 @@ func NewStore(dsn string, watch bool, customDefaults *model.Config) (*Store, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewStoreFromBacking(backingStore, customDefaults)
|
||||
store, err := NewStoreFromBacking(backingStore, customDefaults)
|
||||
if err != nil {
|
||||
backingStore.Close()
|
||||
return nil, errors.Wrap(err, "failed to create store")
|
||||
}
|
||||
|
||||
return store, nil
|
||||
}
|
||||
|
||||
func NewStoreFromBacking(backingStore BackingStore, customDefaults *model.Config) (*Store, error) {
|
||||
|
||||
Ссылка в новой задаче
Block a user