fix(store/v2): chunk.Close is called twice (#23168)

Co-authored-by: Alex | Skip <alex@skip.money>
This commit is contained in:
lfz941 2025-01-07 16:03:51 +08:00 committed by GitHub
parent f77a27432a
commit 26ea9b2f84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,14 +172,15 @@ func (s *Store) Load(height uint64, format uint32) (*types.Snapshot, <-chan io.R
_ = pw.CloseWithError(err)
return
}
defer chunk.Close()
_, err = io.Copy(pw, chunk)
if err != nil {
_ = pw.CloseWithError(err)
return
}
chunk.Close()
pw.Close()
func() {
defer chunk.Close()
_, err = io.Copy(pw, chunk)
if err != nil {
_ = pw.CloseWithError(err)
return
}
pw.Close()
}()
}
}()