Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
checker: address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
csuzhangxc committed Oct 18, 2019
1 parent 86c6402 commit c72263d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ import (
"go.uber.org/zap"
)

const (
// the total time needed to complete the check depends on the number of instances, databases and tables,
// now increase the total timeout to 30min, but set `readTimeout` to 30s for source/target DB.
// if we can not complete the check in 30min, then we must need to refactor the implementation of the function.
checkTimeout = 30 * time.Minute
)

type mysqlInstance struct {
cfg *config.SubTaskConfig

Expand Down Expand Up @@ -234,10 +241,7 @@ func (c *Checker) displayCheckingItems() string {

// Process implements Unit interface
func (c *Checker) Process(ctx context.Context, pr chan pb.ProcessResult) {
// the total time needed to complete the check depends on the number of instances, databases and tables,
// now increase the total timeout to 30min, but set `readTimeout` to 30s for source/target DB.
// if we can not complete the check in 30min, then we must need to refactor the implementation of the function.
cctx, cancel := context.WithTimeout(ctx, 30*time.Minute)
cctx, cancel := context.WithTimeout(ctx, checkTimeout)
defer cancel()

isCanceled := false
Expand Down

0 comments on commit c72263d

Please sign in to comment.