diff --git a/services/search/pkg/service/event/service.go b/services/search/pkg/service/event/service.go index c51f7c7614..28700afa8f 100644 --- a/services/search/pkg/service/event/service.go +++ b/services/search/pkg/service/event/service.go @@ -176,6 +176,7 @@ func (s Service) nakWithDelay(e *raw.Event, id *provider.StorageSpaceId, delay t s.log.Error().Err(err).Interface("spaceID", id).Msg("failed to get the delivery count of the event, giving up on it") return e.Ack() } + // NumDelivered also counts redeliveries caused by an expired ack wait if n >= s.maxIndexRuns { s.log.Warn().Interface("spaceID", id).Uint64("deliveries", n).Msg("the space still has files indexed by name only, run `opencloud search index` to retry them once tika is back") return e.Ack() @@ -206,6 +207,9 @@ func (s Service) processEvent(e raw.Event) error { switch ev := e.Event.Event.(type) { case events.ItemTrashed: + // A redelivered event (after NakWithDelay) replays all of processEvent, not just the debounce, + // so TrashItem runs again without a stat. A file restored in the meantime stays marked as + // deleted until the next walk fixes it. s.index.TrashItem(ev.ID) debounce(getSpaceID(ev.Ref), false) case events.ItemPurged: