Skip to content

Commit

Permalink
chore: debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohith BCS authored and Rohith BCS committed Sep 26, 2024
1 parent f835aa7 commit 9d19988
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions warehouse/internal/loadfiles/loadfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,13 @@ func (lf *LoadFileGenerator) createFromStaging(ctx context.Context, job *model.U
return 0, 0, fmt.Errorf("populating destination revision ID: %w", err)
}

startTime := time.Now()
// Delete previous load files for the staging files
stagingFileIDs := repo.StagingFileIDs(toProcessStagingFiles)
if err := lf.LoadRepo.DeleteByStagingFiles(ctx, stagingFileIDs); err != nil {
return 0, 0, fmt.Errorf("deleting previous load files: %w", err)
}
lf.Logger.Infof("[WH]: Deleted previous load files for staging files %v for %v", time.Since(startTime), destID)

// Set staging file status to executing
if err := lf.StageRepo.SetStatuses(
Expand All @@ -184,6 +186,7 @@ func (lf *LoadFileGenerator) createFromStaging(ctx context.Context, job *model.U
return 0, 0, fmt.Errorf("set staging file status to executing: %w", err)
}

lf.Logger.Infof("[WH]: Set staging file status to executing for staging files %v for %v", time.Since(startTime), destID)
defer func() {
// ensure that if there is an error, we set the staging file status to failed
if err != nil {
Expand Down Expand Up @@ -238,6 +241,7 @@ func (lf *LoadFileGenerator) createFromStaging(ctx context.Context, job *model.U
messages = append(messages, payloadJSON)
}

lf.Logger.Infof("[WH]: Publishing %d staging files in %v for %v", len(messages), time.Since(startTime), destID)
uploadSchemaJSON, err := json.Marshal(struct {
UploadSchema model.Schema
}{
Expand Down

0 comments on commit 9d19988

Please sign in to comment.