@@ -380,16 +380,13 @@ func (s *ChefIngestServer) runReindexingProcess(ctx context.Context, indexList [
380
380
log .WithFields (log.Fields {"requestId" : requestID }).Info ("Heartbeat stopped as process completed" )
381
381
return
382
382
case <- ticker .C :
383
- // Update heartbeat for all indices in this request
383
+ // Log heartbeat for all indices in this request
384
384
for _ , index := range indexList {
385
- if err := s .db .UpdateReindexStatus (requestID , index , "heartbeat" , time .Now ()); err != nil {
386
- log .WithFields (log.Fields {
387
- "requestId" : requestID ,
388
- "index" : index ,
389
- }).WithError (err ).Error ("Failed to update heartbeat" )
390
- }
385
+ log .WithFields (log.Fields {
386
+ "requestId" : requestID ,
387
+ "index" : index ,
388
+ }).Info ("Heartbeat tick" )
391
389
}
392
-
393
390
}
394
391
}
395
392
}()
@@ -472,22 +469,23 @@ func (s *ChefIngestServer) runReindexingProcess(ctx context.Context, indexList [
472
469
}
473
470
}
474
471
475
- finalStatus := STATUS_COMPLETED
476
472
if isFailed {
477
- finalStatus = STATUS_FAILED
473
+ finalStatus : = STATUS_FAILED
478
474
errChan <- status .Errorf (codes .Internal , "failed to reindex indices" )
475
+ if err := s .db .UpdateReindexRequest (requestID , finalStatus , time .Now ()); err != nil {
476
+ log .WithFields (log.Fields {"requestId" : requestID }).WithError (err ).Error ("Failed to update overall status of the request" )
477
+ }
478
+ return status .Errorf (codes .Internal , "failed to reindex indices" )
479
479
}
480
480
481
+ finalStatus := STATUS_COMPLETED
481
482
if err := s .db .UpdateReindexRequest (requestID , finalStatus , time .Now ()); err != nil {
482
483
log .WithFields (log.Fields {"requestId" : requestID }).WithError (err ).Error ("Failed to update overall status of the request" )
484
+ return status .Errorf (codes .Internal , "failed to update overall status of the request" )
483
485
}
484
486
485
- if isFailed {
486
- return status .Errorf (codes .Internal , "failed to reindex indices" )
487
- } else {
488
- log .WithFields (log.Fields {"requestId" : requestID }).Info ("Reindexing process completed successfully" )
489
- return nil
490
- }
487
+ log .WithFields (log.Fields {"requestId" : requestID }).Info ("Reindexing process completed successfully" )
488
+ return nil
491
489
}
492
490
493
491
func (s * ChefIngestServer ) createIndex (ctx context.Context , targetIndex , sourceIndex string , requestID int , stage string , originalIndex string ) error {
0 commit comments