Skip to content

Commit 3b4393d

Browse files
committed
add comments per review feedback
Signed-off-by: GitHub <[email protected]>
1 parent 85ced90 commit 3b4393d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cns/fsnotify/fsnotify.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ func (w *watcher) watchFS(ctx context.Context) error {
114114
}
115115
defer watcher.Close()
116116

117+
// Start watching the directory, so that we don't miss any events.
117118
err = watcher.Add(w.path)
118119
if err != nil {
119120
w.log.Error("failed to add path to fsnotify watcher", zap.String("path", w.path), zap.Error(err))
@@ -163,9 +164,7 @@ func (w *watcher) watchFS(ctx context.Context) error {
163164
// Start starts the filesystem watcher to handle async Pod deletes.
164165
// Blocks until the context is closed; returns underlying fsnotify errors
165166
// if something goes fatally wrong.
166-
func (w *watcher) Start(c context.Context) error {
167-
ctx, cancel := context.WithCancel(c)
168-
defer cancel()
167+
func (w *watcher) Start(ctx context.Context) error {
169168
g, groupCtx := errgroup.WithContext(ctx)
170169
// Start watching for enqueued missed deletes so that we process them as soon as they arrive.
171170
g.Go(func() error { return w.watchPendingDelete(groupCtx) })

cns/service/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ func main() {
852852
return errors.Wrap(err, "failed to start fsnotify watcher, will retry")
853853
}
854854
return nil
855-
}, retry.DelayType(retry.BackOffDelay), retry.Attempts(0), retry.Context(rootCtx))
855+
}, retry.DelayType(retry.BackOffDelay), retry.Attempts(0), retry.Context(rootCtx)) // infinite cancellable exponential backoff retrier
856856
}()
857857
}
858858

0 commit comments

Comments
 (0)