Skip to content

Commit b89100b

Browse files
author
daveaugustus
committed
PR comment changes
Signed-off-by: daveaugustus <[email protected]>
1 parent 480dbef commit b89100b

File tree

1 file changed

+14
-16
lines changed
  • components/ingest-service/server

1 file changed

+14
-16
lines changed

components/ingest-service/server/chef.go

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,13 @@ func (s *ChefIngestServer) runReindexingProcess(ctx context.Context, indexList [
380380
log.WithFields(log.Fields{"requestId": requestID}).Info("Heartbeat stopped as process completed")
381381
return
382382
case <-ticker.C:
383-
// Update heartbeat for all indices in this request
383+
// Log heartbeat for all indices in this request
384384
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")
391389
}
392-
393390
}
394391
}
395392
}()
@@ -472,22 +469,23 @@ func (s *ChefIngestServer) runReindexingProcess(ctx context.Context, indexList [
472469
}
473470
}
474471

475-
finalStatus := STATUS_COMPLETED
476472
if isFailed {
477-
finalStatus = STATUS_FAILED
473+
finalStatus := STATUS_FAILED
478474
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")
479479
}
480480

481+
finalStatus := STATUS_COMPLETED
481482
if err := s.db.UpdateReindexRequest(requestID, finalStatus, time.Now()); err != nil {
482483
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")
483485
}
484486

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
491489
}
492490

493491
func (s *ChefIngestServer) createIndex(ctx context.Context, targetIndex, sourceIndex string, requestID int, stage string, originalIndex string) error {

0 commit comments

Comments
 (0)