Merge pull request #534 from liquidata-inc/aaron/clone-can-fail

go/cmd/dolt: commands/clone: In the case that Clone bailed early, we hung indefinitely.
This commit is contained in:
Aaron Son
2020-04-09 07:07:49 -07:00
committed by GitHub
2 changed files with 2 additions and 5 deletions
+2 -1
View File
@@ -273,9 +273,9 @@ func cloneProg(eventCh <-chan datas.TableFileEvent) {
}
func cloneRemote(ctx context.Context, srcDB *doltdb.DoltDB, remoteName, branch string, dEnv *env.DoltEnv) errhand.VerboseError {
wg := &sync.WaitGroup{}
eventCh := make(chan datas.TableFileEvent, 128)
wg := &sync.WaitGroup{}
wg.Add(1)
go func() {
defer wg.Done()
@@ -283,6 +283,7 @@ func cloneRemote(ctx context.Context, srcDB *doltdb.DoltDB, remoteName, branch s
}()
err := actions.Clone(ctx, srcDB, dEnv.DoltDB, eventCh)
close(eventCh)
wg.Wait()
-4
View File
@@ -106,10 +106,6 @@ func mapTableFiles(tblFiles []nbs.TableFile) ([]string, map[string]nbs.TableFile
}
func clone(ctx context.Context, srcTS, sinkTS nbs.TableFileStore, eventCh chan<- TableFileEvent) error {
if eventCh != nil {
defer close(eventCh)
}
root, tblFiles, err := srcTS.Sources(ctx)
if err != nil {