Skip to content

Commit

Permalink
fix: Fix remove bulkinsert job command
Browse files Browse the repository at this point in the history
Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper committed Jan 10, 2025
1 parent 72d7818 commit cbc5f4f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions states/etcd/common/bulkinsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,25 @@ func ListImportJobs(ctx context.Context, cli clientv3.KV, basePath string, filte
return nil, nil, err
}

return lo.FilterMap(jobs, func(job datapb.ImportJob, idx int) (*datapb.ImportJob, bool) {
resultJobs := make([]*datapb.ImportJob, 0, len(jobs))
resultKeys := make([]string, 0, len(keys))

filterFn := func(job datapb.ImportJob) bool {
for _, filter := range filters {
if !filter(&job) {
return nil, false
return false
}
}
return &job, true
}), keys, nil
return true
}
for i, job := range jobs {
if ok := filterFn(job); ok {
resultJobs = append(resultJobs, &jobs[i])
resultKeys = append(resultKeys, keys[i])
}
}

return resultJobs, resultKeys, nil
}

// ListPreImportTasks list pre-import tasks.
Expand Down

0 comments on commit cbc5f4f

Please sign in to comment.