Skip to content

Commit cf3e738

Browse files
committed
add comments per review feedback
Signed-off-by: GitHub <[email protected]>
1 parent 7214e2c commit cf3e738

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
@@ -838,7 +838,7 @@ func main() {
838838
return errors.Wrap(err, "failed to start fsnotify watcher, will retry")
839839
}
840840
return nil
841-
}, retry.DelayType(retry.BackOffDelay), retry.Attempts(0), retry.Context(rootCtx))
841+
}, retry.DelayType(retry.BackOffDelay), retry.Attempts(0), retry.Context(rootCtx)) // infinite cancellable exponential backoff retrier
842842
}()
843843
}
844844

0 commit comments

Comments
 (0)