fix
This commit is contained in:
@@ -598,6 +598,7 @@ func (p *Pipeline) ProcessJob(ctx context.Context, jobID uuid.UUID) error {
|
||||
return err
|
||||
}
|
||||
if !IsProcessableJobStatus(status) {
|
||||
log.Printf("processing: skip job=%s status=%s reason=not_processable", jobID, status)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -625,6 +626,9 @@ func (p *Pipeline) ProcessJob(ctx context.Context, jobID uuid.UUID) error {
|
||||
modeLabel = label
|
||||
}
|
||||
|
||||
log.Printf("processing: start job=%s company=%s type=%s mode=%s prior_processed=%d",
|
||||
jobID, companyID, processingType, modeLabel, alreadyProcessed)
|
||||
|
||||
progress := InitialStepProgress(processingType)
|
||||
if len(progress) > 0 {
|
||||
progress[0].Status = "running"
|
||||
@@ -648,6 +652,11 @@ func (p *Pipeline) ProcessJob(ctx context.Context, jobID uuid.UUID) error {
|
||||
batch := resolveBatchSize(p.BatchSize)
|
||||
progressEvery := resolveProgressEvery(p.ProgressEvery)
|
||||
jobCache := p.loadJobScopedCache(ctx, companyID, jobID)
|
||||
if !jobCache.stepPolicy().AllowAI {
|
||||
log.Printf("processing: ai_skip job=%s reason=entitlement_can_use_ai", jobID)
|
||||
} else if !jobEngine.CompleterEnabled() {
|
||||
log.Printf("processing: ai_skip job=%s reason=openai_not_configured", jobID)
|
||||
}
|
||||
processed := alreadyProcessed
|
||||
failed := 0
|
||||
tokenTotal := 0
|
||||
@@ -672,6 +681,7 @@ func (p *Pipeline) ProcessJob(ctx context.Context, jobID uuid.UUID) error {
|
||||
flushProgress(true)
|
||||
if errors.Is(err, errJobCancelled) {
|
||||
_ = p.reclaimOrphanedProcessingItems(ctx, jobID)
|
||||
log.Printf("processing: cancelled job=%s", jobID)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("processing: check cancel job=%s: %w", jobID, err)
|
||||
@@ -728,6 +738,7 @@ func (p *Pipeline) ProcessJob(ctx context.Context, jobID uuid.UUID) error {
|
||||
flushProgress(true)
|
||||
if errors.Is(err, errJobCancelled) {
|
||||
_ = p.reclaimOrphanedProcessingItems(ctx, jobID)
|
||||
log.Printf("processing: cancelled job=%s", jobID)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("processing: check cancel job=%s: %w", jobID, err)
|
||||
@@ -807,7 +818,8 @@ func (p *Pipeline) ProcessJob(ctx context.Context, jobID uuid.UUID) error {
|
||||
current_step = $6, step_progress = $7::jsonb,
|
||||
ai_provider_mode = $8
|
||||
WHERE id = $1 AND status = 'running'`, jobID, finalStatus, processed, errMsg, tokenTotal, finalStep, finalJSON, finalMode)
|
||||
log.Printf("processing: finished job=%s status=%s processed=%d failed=%d mode=%s", jobID, finalStatus, processed, failed, finalMode)
|
||||
log.Printf("processing: finished job=%s status=%s processed=%d failed=%d mode=%s event=%s",
|
||||
jobID, finalStatus, processed, failed, finalMode, finalStatus)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1556,7 +1568,12 @@ func (p *Pipeline) processOne(ctx context.Context, companyID, jobID uuid.UUID, i
|
||||
// name tokens are not wiped. Empty taxonomy set skips filtering (unit tests).
|
||||
if cache != nil {
|
||||
coerceCategoryToCompanyUniqueID(&result, cache.categoryNamesByUID, cache.categoryUniqueIDs)
|
||||
catPreFilter := strings.TrimSpace(result.Category)
|
||||
filterCategoryIfInvalid(&result, cache.categoryUniqueIDs)
|
||||
if catPreFilter != "" && strings.TrimSpace(result.Category) == "" {
|
||||
log.Printf("processing: category_empty job=%s raw=%s rejected=%s reason=unknown_unique_id",
|
||||
jobID, it.RawID, catPreFilter)
|
||||
}
|
||||
syncCategoryName(&result, cache.categoryNamesByUID)
|
||||
}
|
||||
// Re-apply after category validation so allowlist matches the persisted category.
|
||||
|
||||
Reference in New Issue
Block a user