mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-01 20:00:22 -05:00
fix bats
This commit is contained in:
@@ -66,11 +66,9 @@ func (rws *ReaderWithStats) Start(updateFunc func(ReadStats)) {
|
||||
}()
|
||||
}
|
||||
|
||||
// Close is equivalent to Stop
|
||||
func (rws *ReaderWithStats) Close() error {
|
||||
return rws.Stop()
|
||||
}
|
||||
|
||||
// Stop "closes" ReaderWithStats. Occasionally, we might pass this ReaderWithStats as the body of
|
||||
// a http.Request. Since http.Request will close the body if it is an io.Closer, we can't have ReaderWithStats conform
|
||||
// to io.Closer. We want full control over the Start and Stop of ReaderWithStats.
|
||||
func (rws *ReaderWithStats) Stop() error {
|
||||
close(rws.closeCh)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ package pull
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/cenkalti/backoff"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -86,8 +85,8 @@ func mapTableFiles(tblFiles []nbs.TableFile) ([]string, map[string]nbs.TableFile
|
||||
return fileIds, fileIDtoTblFile, fileIDtoNumChunks
|
||||
}
|
||||
|
||||
func CloseWithErr(c io.Closer, err *error) {
|
||||
e := c.Close()
|
||||
func stopWithErr(stats *iohelp.ReaderWithStats, err *error) {
|
||||
e := stats.Stop()
|
||||
if *err == nil && e != nil {
|
||||
*err = e
|
||||
}
|
||||
@@ -144,7 +143,7 @@ func clone(ctx context.Context, srcTS, sinkTS nbs.TableFileStore, eventCh chan<-
|
||||
return err
|
||||
}
|
||||
rdStats := iohelp.NewReaderWithStats(rd, int64(contentLength))
|
||||
defer CloseWithErr(rdStats, &err)
|
||||
defer stopWithErr(rdStats, &err)
|
||||
|
||||
rdStats.Start(func(s iohelp.ReadStats) {
|
||||
report(TableFileEvent{
|
||||
|
||||
Reference in New Issue
Block a user