Merged in jmathison/v2-upload-batch (pull request #224)
Implement v2 upload batch cleanup * Implement v2 upload batch cleanup * Merge remote-tracking branch 'origin/main' into jmathison/v2-upload-batch * Address upload batch review feedback * Raise batch worker coverage * Fix batch cleanup review issues Approved-by: Jay Brown
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"log/slog"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/document/batch/foldercleanup"
|
||||
"queryorchestration/internal/document/batch/outcome"
|
||||
documentinit "queryorchestration/internal/document/init"
|
||||
"queryorchestration/internal/serviceconfig/objectstore"
|
||||
@@ -26,6 +27,7 @@ type Services struct {
|
||||
Document *documentinit.Service
|
||||
Queries *repository.Queries
|
||||
Outcome *outcome.Reporter
|
||||
Cleanup *foldercleanup.Service
|
||||
}
|
||||
|
||||
// Runner processes document init messages from the SQS queue.
|
||||
@@ -108,6 +110,13 @@ func (s Runner) Process(ctx context.Context, body Body) bool {
|
||||
"document_id", result.ID, "outcome", outcomeName, "error", resolveErr)
|
||||
// Non-fatal: document was created successfully
|
||||
}
|
||||
if outcomeName == repository.BatchOutcomeStatusInitDuplicate {
|
||||
if s.svc.Cleanup != nil && result.BatchID != nil {
|
||||
if _, err := s.svc.Cleanup.TryFinalizeBatch(ctx, *result.BatchID); err != nil {
|
||||
slog.Error("failed to finalize batch folder cleanup", "batch_id", *result.BatchID, "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user