Skip to content

Commit

Permalink
Merge pull request #28 from BloodHoundAD/fix-hang-during-upload
Browse files Browse the repository at this point in the history
fix: properly end task even when ingest fails
  • Loading branch information
superlinkx authored Feb 13, 2023
2 parents a46e818 + 2e5f3be commit b3a75f3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ func start(ctx context.Context) {
stream := listAll(ctx, azClient)
batches := pipeline.Batch(ctx.Done(), stream, 999, 10*time.Second)
if err := ingest(ctx, *bheInstance, bheClient, batches); err != nil {
log.Error(err, "ingestion failed; collection will be re-attempted")
} else {
// Notify BHE instance of task end
duration := time.Since(start)
if err := endTask(ctx, *bheInstance, bheClient); err != nil {
log.Error(err, "failed to end task")
} else {
log.Info("finished collection task", "id", currentTask.Id, "duration", duration.String())
}
log.Error(err, "ingestion failed")
}

currentTask = nil
// Notify BHE instance of task end
duration := time.Since(start)
if err := endTask(ctx, *bheInstance, bheClient); err != nil {
log.Error(err, "failed to end task")
} else {
log.Info("finished collection task", "id", currentTask.Id, "duration", duration.String())
}

currentTask = nil
}
}
}()
Expand Down

0 comments on commit b3a75f3

Please sign in to comment.