Skip to content

Commit

Permalink
fix: resource hangs on context canceled
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed May 29, 2023
1 parent 1d082bd commit 0c195e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 5 additions & 1 deletion pkg/tracker/generic/resource_state_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,9 @@ func (w *ResourceStateWatcher) Run(ctx context.Context, resourceAddedCh, resourc
fmt.Printf(" %s resource watcher DONE\n", w.ResourceID)
}

return fatalWatchErr
if fatalWatchErr.Err != nil {
return fatalWatchErr
} else {
return nil
}
}
7 changes: 1 addition & 6 deletions pkg/tracker/generic/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package generic

import (
"context"
"errors"
"fmt"
"os"
"sync"
Expand Down Expand Up @@ -115,11 +114,7 @@ func (t *Tracker) Track(ctx context.Context, noActivityTimeout time.Duration, ad
case <-time.After(noActivityTimeout):
failedCh <- NewFailedResourceStatus(fmt.Sprintf("marking resource as failed because no activity for %s", noActivityTimeout))
case err := <-stateWatcherErrCh:
var unrecoverableWatchErr *UnrecoverableWatchError
if errors.As(err, &unrecoverableWatchErr) {
succeededCh <- NewSucceededResourceStatus()
return nil
} else {
if err != nil {
return err
}
case err := <-eventWatcherErrCh:
Expand Down

0 comments on commit 0c195e2

Please sign in to comment.