Skip to content

Commit fcc814f

Browse files
committed
topom: limit the timeout of nonblocking migration to 5s
1 parent 78b2c3a commit fcc814f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/topom/topom_slots.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ package topom
55

66
import (
77
"sort"
8+
"time"
89

910
rbtree "github.com/emirpasic/gods/trees/redblacktree"
1011

1112
"github.com/CodisLabs/codis/pkg/models"
1213
"github.com/CodisLabs/codis/pkg/utils/errors"
1314
"github.com/CodisLabs/codis/pkg/utils/log"
15+
"github.com/CodisLabs/codis/pkg/utils/math2"
1416
"github.com/CodisLabs/codis/pkg/utils/redis"
1517
)
1618

@@ -412,7 +414,8 @@ func (s *Topom) newSlotActionExecutor(sid int) (func(db int) (remains int, nextd
412414
MaxBulks: s.config.MigrationAsyncMaxBulks,
413415
MaxBytes: s.config.MigrationAsyncMaxBytes.AsInt(),
414416
NumKeys: s.config.MigrationAsyncNumKeys,
415-
Timeout: s.config.MigrationTimeout.Duration(),
417+
Timeout: math2.MinDuration(time.Second*5,
418+
s.config.MigrationTimeout.Duration()),
416419
}
417420
do = func() (int, error) {
418421
return c.MigrateSlotAsync(sid, dest, option)

0 commit comments

Comments
 (0)