Skip to content

Commit 0ed4a18

Browse files
authored
fix: fallback to create when resource isn't found while update (#24)
1 parent 469b5f8 commit 0ed4a18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/adapter/etcd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,13 @@ func (a *adapter) handleUpdateEvent(ctx context.Context, ev *Event) {
163163
return
164164
}
165165
if prevKV == nil {
166-
log.Error("object not found (during update event), ignore it",
166+
log.Info("object not found (during update event), ignore it",
167167
zap.Int64("revision", rev),
168168
zap.String("key", ev.Key),
169169
)
170+
// Fallback to add event when the resource isn't found
171+
ev.Type = EventAdd
172+
a.handleAddEvent(ctx, ev)
170173
return
171174
}
172175
rev, prev, ok, err := a.backend.Update(ctx, ev.Key, ev.Value, prevKV.ModRevision, 0)

0 commit comments

Comments
 (0)