Skip to content

Commit

Permalink
backport commit
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Savian <[email protected]>
  • Loading branch information
vitorsavian committed Jan 10, 2025
1 parent 857025d commit 71f77d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ require (
github.com/go-test/deep v1.0.7
github.com/golang/mock v1.6.0
github.com/google/cadvisor v0.49.0
github.com/google/go-containerregistry v0.20.2
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.1
Expand Down Expand Up @@ -168,7 +169,6 @@ require (
k8s.io/kubernetes v1.30.5
k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3
sigs.k8s.io/yaml v1.4.0
github.com/google/go-containerregistry v0.20.2
)

require (
Expand Down Expand Up @@ -246,6 +246,7 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
Expand Down
18 changes: 15 additions & 3 deletions pkg/agent/containerd/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
type Watcher struct {
watcher *fsnotify.Watcher
filesCache map[string]fs.FileInfo
workqueue workqueue.TypedDelayingInterface[string]
workqueue workqueue.DelayingInterface
}

func CreateWatcher() (*Watcher, error) {
Expand All @@ -36,7 +36,7 @@ func CreateWatcher() (*Watcher, error) {
return &Watcher{
watcher: watcher,
filesCache: make(map[string]fs.FileInfo),
workqueue: workqueue.TypedNewDelayingQueue[string](),
workqueue: workqueue.NewDelayingQueue(),
}, nil
}

Expand Down Expand Up @@ -136,7 +136,19 @@ func (w *Watcher) processNextEventForImages(ctx context.Context, cfg *config.Nod
return true
}

func (w *Watcher) processImageEvent(ctx context.Context, key string, cfg *config.Node, client *containerd.Client, imageClient runtimeapi.ImageServiceClient) error {
func (w *Watcher) processImageEvent(ctx context.Context, obj interface{}, cfg *config.Node, client *containerd.Client, imageClient runtimeapi.ImageServiceClient) error {
var (
key string
ok bool
)

defer w.workqueue.Done(obj)

if key, ok = obj.(string); !ok {
logrus.Errorf("expected string in workqueue but got %#v", obj)
return nil
}

defer w.workqueue.Done(key)

file, err := os.Stat(key)
Expand Down

0 comments on commit 71f77d4

Please sign in to comment.