minio connection log

This commit is contained in:
Mazyar
2026-05-16 14:08:58 +03:30
parent 6701428b09
commit bcb345103f
5 changed files with 186 additions and 18 deletions
+24 -5
View File
@@ -187,6 +187,14 @@ func (s *tenderService) lookupSummaryForTender(ctx context.Context, t *Tender) (
if !errors.Is(err, ai_summarizer.ErrObjectNotFound) &&
!errors.Is(err, ai_summarizer.ErrSummaryNotReady) &&
!errors.Is(err, ai_summarizer.ErrNoOverallSummary) {
if errors.Is(err, ai_summarizer.ErrMinIOUnavailable) {
s.logger.Error("MinIO unavailable while fetching AI summary", map[string]interface{}{
"tender_id": t.ID,
"contract_folder_id": t.ContractFolderID,
"notice_id": noticeID,
"error": err.Error(),
})
}
return "", noticeID, err
}
}
@@ -889,6 +897,15 @@ func (s *tenderService) GetAISummary(ctx context.Context, id string) (*AISummary
if errors.Is(err, ai_summarizer.ErrObjectNotFound) || errors.Is(err, ai_summarizer.ErrNoOverallSummary) {
return emptyResp("unavailable"), nil
}
if errors.Is(err, ai_summarizer.ErrMinIOUnavailable) {
s.logger.Error("Cannot retrieve AI summary: MinIO connection unavailable", map[string]interface{}{
"tender_id": id,
"contract_folder_id": t.ContractFolderID,
"notice_id": noticeID,
"error": err.Error(),
})
return nil, fmt.Errorf("failed to get AI summary: MinIO connection unavailable: %w", err)
}
return nil, fmt.Errorf("failed to get AI summary: %w", err)
}
@@ -988,9 +1005,6 @@ func (s *tenderService) TriggerAISummarize(ctx context.Context, id string) (*AIS
// It lists all tender.json files in the bucket and returns summaries for tenders
// where the AI pipeline has completed processing.
func (s *tenderService) GetAllAISummaries(ctx context.Context) ([]ai_summarizer.TenderSummaryItem, error) {
if s.aiSummarizerStorage == nil {
return nil, fmt.Errorf("AI summarizer storage is not configured")
}
s.logger.Info("Retrieving all AI summaries from storage", map[string]interface{}{})
@@ -1007,9 +1021,14 @@ func (s *tenderService) GetAllAISummaries(ctx context.Context) ([]ai_summarizer.
results, err := storage.GetAllSummaries(ctx)
if err != nil {
s.logger.Error("Failed to get all AI summaries", map[string]interface{}{
fields := map[string]interface{}{
"error": err.Error(),
})
}
if errors.Is(err, ai_summarizer.ErrMinIOUnavailable) {
s.logger.Error("Failed to list AI summaries: MinIO connection unavailable", fields)
return nil, fmt.Errorf("failed to get all AI summaries: MinIO connection unavailable: %w", err)
}
s.logger.Error("Failed to get all AI summaries from MinIO", fields)
return nil, fmt.Errorf("failed to get all AI summaries: %w", err)
}