Skip to content

Commit

Permalink
fixed that ThingDeleted events could run into situations where the se…
Browse files Browse the repository at this point in the history
…arch-index would not process this event

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Mar 18, 2022
1 parent 253c2d6 commit ded830e
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -194,7 +194,6 @@ private Source<Pair<ThingId, JsonObject>, NotUsed> retrieveThingFromCachingFacad
}

return Source.completionStage(thingFuture)
.filter(thing -> !thing.isEmpty())
.map(thing -> Pair.create(thingId, thing))
.recoverWithRetries(1, new PFBuilder<Throwable, Source<Pair<ThingId, JsonObject>, NotUsed>>()
.match(Throwable.class, error -> {
Expand All @@ -214,7 +213,7 @@ private Source<AbstractWriteModel, NotUsed> computeWriteModel(final Metadata met
return Instant.EPOCH;
})))
.orElse(null);
if (latestEvent instanceof ThingDeleted || thing == null) {
if (latestEvent instanceof ThingDeleted || thing == null || thing.isEmpty()) {
return Source.single(ThingDeleteModel.of(metadata));
} else {
return getEnforcer(metadata, thing)
Expand Down

0 comments on commit ded830e

Please sign in to comment.