mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-05 02:59:44 -06:00
go/libraries/doltcore/diff: Add recover in async_differ goroutine.
This commit is contained in:
@@ -17,6 +17,7 @@ package diff
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -52,8 +53,13 @@ func tableDontDescendLists(v1, v2 types.Value) bool {
|
||||
|
||||
func (ad *AsyncDiffer) Start(ctx context.Context, from, to types.Map) {
|
||||
ad.eg, ad.egCtx = errgroup.WithContext(ctx)
|
||||
ad.egCancel = async.GoWithCancel(ad.egCtx, ad.eg, func(ctx context.Context) error {
|
||||
ad.egCancel = async.GoWithCancel(ad.egCtx, ad.eg, func(ctx context.Context) (err error) {
|
||||
defer close(ad.diffChan)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
err = fmt.Errorf("panic in diff.Diff: %v", r)
|
||||
}
|
||||
}()
|
||||
return diff.Diff(ctx, from, to, ad.diffChan, true, tableDontDescendLists)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user