Skip to content

Commit c9441dc

Browse files
committed
Fix runner cancel
1 parent a9b38ce commit c9441dc

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pkg/runner/chunk_runner.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ func (r *ChunkRunner) startProgressUpdater(ctx context.Context, s *state, gsr **
680680
prevStatus *v1alpha1.ChunkStatus
681681
lastUpdateTime time.Time
682682
)
683+
684+
ctx, cancel := context.WithCancel(ctx)
685+
683686
chunkFunc := func() {
684687
s.Update(func(ss *v1alpha1.Chunk) *v1alpha1.Chunk {
685688
if *gsr != nil {
@@ -698,7 +701,11 @@ func (r *ChunkRunner) startProgressUpdater(ctx context.Context, s *state, gsr **
698701
})
699702

700703
if err != nil {
701-
handleProcessError(ss, "ProgressUpdateError", err)
704+
if apierrors.IsNotFound(err) {
705+
cancel()
706+
return ss
707+
}
708+
klog.Infof("Failed to update chunk status for chunk %s: %v", ss.Name, err)
702709
return ss
703710
}
704711

@@ -765,7 +772,7 @@ func (r *ChunkRunner) waitForPartialChunk(chunk *v1alpha1.Chunk, s *state, swmr
765772
for {
766773
pchunk, err := chunks.Get(context.Background(), chunk.Spec.Sha256PartialPreviousName, metav1.GetOptions{})
767774
if err != nil {
768-
if !apierrors.IsNotFound(err) {
775+
if apierrors.IsNotFound(err) {
769776
s.handleProcessError("GetPartialChunkError", err)
770777
return
771778
}

0 commit comments

Comments
 (0)