Skip to content

Commit ebab77b

Browse files
committed
retry list operation
1 parent 2062b7e commit ebab77b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sugar/sugar.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,20 @@ func RemoveRecursive(ctx context.Context, db ydb.Connection, pathToRemove string
6767
fullSysTablePath := path.Join(db.Name(), sysTable)
6868
var list func(int, string) error
6969
list = func(i int, p string) error {
70-
dir, err := db.Scheme().ListDirectory(ctx, p)
70+
var dir scheme.Directory
71+
var err error
72+
err = retry.Retry(ctx, true, func(ctx context.Context) (err error) {
73+
dir, err = db.Scheme().ListDirectory(ctx, p)
74+
return err
75+
})
7176
var opErr *errors.OpError
7277
if errors.As(err, &opErr) && opErr.Reason == errors.StatusSchemeError {
7378
return nil
7479
}
7580
if err != nil {
7681
return err
7782
}
83+
7884
for _, child := range dir.Children {
7985
pt := path.Join(p, child.Name)
8086
if pt == fullSysTablePath {

0 commit comments

Comments
 (0)