fix(storev2/snapshots): Close StateChanges channel in doRestoreSnapshot (#21106)

This commit is contained in:
Hieu Vu 2024-08-02 16:49:01 +07:00 committed by GitHub
parent e507900e45
commit bc72e34d55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -400,7 +400,6 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io.
// chStorage is the channel to pass the KV pairs to the storage snapshotter.
chStorage := make(chan *corestore.StateChanges, defaultStorageChannelBufferSize)
defer close(chStorage)
storageErrs := make(chan error, 1)
go func() {
@ -415,6 +414,7 @@ func (m *Manager) doRestoreSnapshot(snapshot types.Snapshot, chChunks <-chan io.
if err != nil {
return errorsmod.Wrap(err, "multistore restore")
}
close(chStorage)
for {
if nextItem.Item == nil {