[TEST] make the indexer and pull tasks cancellable (without shutdown)
This commit is contained in:
parent
0905961fde
commit
d79690ce18
2 changed files with 11 additions and 3 deletions
|
@ -120,9 +120,12 @@ func Init() {
|
|||
case "bleve", "elasticsearch":
|
||||
handler := func(items ...*internal.IndexerData) (unhandled []*internal.IndexerData) {
|
||||
indexer := *globalIndexer.Load()
|
||||
// make it a process to allow for cancellation (especially during integration tests where no global shutdown happens)
|
||||
batchCtx, _, finished := process.GetManager().AddContext(ctx, "CodeIndexer batch")
|
||||
defer finished()
|
||||
for _, indexerData := range items {
|
||||
log.Trace("IndexerData Process Repo: %d", indexerData.RepoID)
|
||||
if err := index(ctx, indexer, indexerData.RepoID); err != nil {
|
||||
if err := index(batchCtx, indexer, indexerData.RepoID); err != nil {
|
||||
unhandled = append(unhandled, indexerData)
|
||||
if !setting.IsInTesting {
|
||||
log.Error("Codes indexer handler: index error for repo %v: %v", indexerData.RepoID, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue