add timeout to context

This commit is contained in:
medcl 2023-11-18 13:28:23 +08:00
parent 6139c6adbb
commit 3b91a57bc1
2 changed files with 6 additions and 2 deletions

View File

@ -97,7 +97,9 @@ func (p *processor) splitMajorTask(taskItem *task.Task) error {
var sourceTotalDocs int64
var targetTotalDocs int64
ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*60))
defer cancel()
for i, index := range clusterComparisonTask.Indices {
sourceDump := migration_model.IndexComparisonDumpConfig{

View File

@ -96,7 +96,9 @@ func (p *processor) splitMajorMigrationTask(taskItem *task.Task) error {
pids = append(pids, taskItem.ID)
var totalDocs int64
ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Second*60))
defer cancel()
for i, index := range clusterMigrationTask.Indices {
source := migration_model.IndexMigrationSourceConfig{