File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
server/internal/infprocessor Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -493,7 +493,6 @@ func (p *P) enqueueAndProcessTask(
493
493
494
494
// Process the task results.
495
495
for {
496
- var hasReceivedResult bool
497
496
select {
498
497
case <- ctx .Done ():
499
498
log .Error (ctx .Err (), "Task completed due to context cancel" )
@@ -512,7 +511,9 @@ func (p *P) enqueueAndProcessTask(
512
511
}
513
512
514
513
err = processResult (r .result )
515
- task .nextResultIndex ++
514
+ if err == nil {
515
+ task .nextResultIndex ++
516
+ }
516
517
}
517
518
518
519
if err != nil {
@@ -521,7 +522,7 @@ func (p *P) enqueueAndProcessTask(
521
522
}
522
523
523
524
// Retry if possible. Do not retry once the task has received a result.
524
- if hasReceivedResult || ! p .canRetry (task , err ) {
525
+ if task . nextResultIndex > 0 || ! p .canRetry (task , err ) {
525
526
log .Error (err , "Failed to process the task" )
526
527
return err
527
528
}
@@ -542,8 +543,6 @@ func (p *P) enqueueAndProcessTask(
542
543
continue
543
544
}
544
545
545
- hasReceivedResult = true
546
-
547
546
// Check if the task is completed.
548
547
completed , err := isTaskCompleted (task , r .result )
549
548
if err != nil {
You can’t perform that action at this time.
0 commit comments