Skip to content

Commit

Permalink
Reset thing ID lower bound in background sync if force-update is true
Browse files Browse the repository at this point in the history
Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
  • Loading branch information
yufei-cai committed Jun 23, 2022
1 parent e8e01de commit 95d21e3
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,19 @@ private Procedure<Metadata> handleInconsistency(final boolean forceUpdateAllThin
}

private Source<ThingId, NotUsed> getLowerBoundSource() {
return backgroundSyncPersistence.getTaggedTimestamp()
.map(optional -> {
if (optional.isPresent()) {
final String bookmarkedThingId = optional.get().second();
if (bookmarkedThingId != null && !bookmarkedThingId.isEmpty())
return ThingId.of(bookmarkedThingId);
}
return EMPTY_THING_ID;
});
if (forceUpdateAllThings) {
return Source.single(EMPTY_THING_ID);
} else {
return backgroundSyncPersistence.getTaggedTimestamp()
.map(optional -> {
if (optional.isPresent()) {
final String bookmarkedThingId = optional.get().second();
if (bookmarkedThingId != null && !bookmarkedThingId.isEmpty())
return ThingId.of(bookmarkedThingId);
}
return EMPTY_THING_ID;
});
}
}

private Source<Metadata, NotUsed> getPersistedMetadataSourceWithProgressReporting(final ThingId lowerBound) {
Expand Down

0 comments on commit 95d21e3

Please sign in to comment.