Skip to content

Commit

Permalink
fix: resource eventsource duplicate update events. Fixes #760 (#1025) (
Browse files Browse the repository at this point in the history
…#1404)

Signed-off-by: dubeau <28494057+dubeau@users.noreply.github.com>
  • Loading branch information
dubeau committed Nov 3, 2021
1 parent 4a1bf22 commit aff2726
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eventsources/sources/resource/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt
case v1alpha1.UPDATE:
handlerFuncs.UpdateFunc = func(oldObj, newObj interface{}) {
log.Info("detected update event")
uNewObj := newObj.(*unstructured.Unstructured)
uOldObj := oldObj.(*unstructured.Unstructured)
if uNewObj.GetResourceVersion() == uOldObj.GetResourceVersion() {
log.Infof("rejecting update event with identical resource versions: %s", uNewObj.GetResourceVersion())
return
}
informerEventCh <- &InformerEvent{
Obj: newObj,
OldObj: oldObj,
Expand Down

0 comments on commit aff2726

Please sign in to comment.