Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions background.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ func StartBackgroundTasks(ctx context.Context, app BackgroundProcessor) {
}

// Run auto-tagging after OCR
autoCount, err := app.processAutoTagDocuments(ctx)
if err != nil {
return 0, fmt.Errorf("error in processAutoTagDocuments: %w", err)
// Only run auto-tagging if OCR did not find any documents to process, otherwise re-run OCR
if count == 0 {
autoCount, err := app.processAutoTagDocuments(ctx)
if err != nil {
return 0, fmt.Errorf("error in processAutoTagDocuments: %w", err)
}
count += autoCount
}
count += autoCount

return count, nil
}()
Expand Down