Skip to content

Commit

Permalink
fix: fallback to create when resource isn't found while update (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Revolyssup authored Dec 1, 2023
1 parent 469b5f8 commit 0ed4a18
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/adapter/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,13 @@ func (a *adapter) handleUpdateEvent(ctx context.Context, ev *Event) {
return
}
if prevKV == nil {
log.Error("object not found (during update event), ignore it",
log.Info("object not found (during update event), ignore it",
zap.Int64("revision", rev),
zap.String("key", ev.Key),
)
// Fallback to add event when the resource isn't found
ev.Type = EventAdd
a.handleAddEvent(ctx, ev)
return
}
rev, prev, ok, err := a.backend.Update(ctx, ev.Key, ev.Value, prevKV.ModRevision, 0)
Expand Down

0 comments on commit 0ed4a18

Please sign in to comment.