fix: recover should be added if chunk do updated

This commit is contained in:
Ho
2026-03-02 14:14:28 +09:00
parent 03fce0db33
commit 11c76800a2
3 changed files with 13 additions and 14 deletions

View File

@@ -163,17 +163,17 @@ func (bp *BatchProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
log.Error("failed to update batch attempts", "height", getTaskParameter.ProverHeight, "err", updateAttemptsErr)
return nil, ErrCoordinatorInternalFailure
}
if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}
defer func(batchTask *orm.Batch) {
if retErr != nil {
bp.recoverActiveAttempts(ctx, batchTask)
log.Debug("recover active attempts", "batch task_id", batchTask.Hash)
}
}(tmpBatchTask)
if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}
}
batchTask = tmpBatchTask

View File

@@ -161,17 +161,16 @@ func (bp *BundleProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinat
log.Error("failed to update bundle attempts", "height", getTaskParameter.ProverHeight, "err", updateAttemptsErr)
return nil, ErrCoordinatorInternalFailure
}
if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}
defer func(bundleTask *orm.Bundle) {
if retErr != nil {
bp.recoverActiveAttempts(ctx, bundleTask)
log.Debug("recover active attempts", "bundle task_id", bundleTask.Hash)
}
}(tmpBundleTask)
if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}
}
bundleTask = tmpBundleTask
break

View File

@@ -166,6 +166,10 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
log.Error("failed to update chunk attempts", "height", getTaskParameter.ProverHeight, "err", updateAttemptsErr)
return nil, ErrCoordinatorInternalFailure
}
if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}
defer func(chunkTask *orm.Chunk) {
if retErr != nil {
cp.recoverActiveAttempts(ctx, chunkTask)
@@ -173,10 +177,6 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
}
}(tmpChunkTask)
if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}
}
chunkTask = tmpChunkTask
break