[#1085] shard: Close components in reverse order
Write-cache should be closed before blobstor and metabase. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
b432ec3a03
commit
3215210d0c
1 changed files with 3 additions and 3 deletions
|
@ -127,14 +127,14 @@ func (s *Shard) refillMetabase() error {
|
|||
|
||||
// Close releases all Shard's components.
|
||||
func (s *Shard) Close() error {
|
||||
components := []interface{ Close() error }{
|
||||
s.blobStor, s.metaBase,
|
||||
}
|
||||
components := []interface{ Close() error }{}
|
||||
|
||||
if s.hasWriteCache() {
|
||||
components = append(components, s.writeCache)
|
||||
}
|
||||
|
||||
components = append(components, s.blobStor, s.metaBase)
|
||||
|
||||
for _, component := range components {
|
||||
if err := component.Close(); err != nil {
|
||||
return fmt.Errorf("could not close %s: %w", component, err)
|
||||
|
|
Loading…
Reference in a new issue