Merge pull request #6323 from jepio/jepio/fix-cgroupv2-oom-event

This commit is contained in:
Fu Wei 2022-03-24 15:51:28 +08:00 committed by GitHub
commit e7cba85e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,15 +71,15 @@ func (w *watcher) Run(ctx context.Context) {
continue continue
} }
lastOOM := lastOOMMap[i.id] lastOOM := lastOOMMap[i.id]
if i.ev.OOM > lastOOM { if i.ev.OOMKill > lastOOM {
if err := w.publisher.Publish(ctx, runtime.TaskOOMEventTopic, &eventstypes.TaskOOM{ if err := w.publisher.Publish(ctx, runtime.TaskOOMEventTopic, &eventstypes.TaskOOM{
ContainerID: i.id, ContainerID: i.id,
}); err != nil { }); err != nil {
logrus.WithError(err).Error("publish OOM event") logrus.WithError(err).Error("publish OOM event")
} }
} }
if i.ev.OOM > 0 { if i.ev.OOMKill > 0 {
lastOOMMap[i.id] = i.ev.OOM lastOOMMap[i.id] = i.ev.OOMKill
} }
} }
} }