Skip to content

Commit

Permalink
Fixing retry for any
Browse files Browse the repository at this point in the history
  • Loading branch information
johanhaleby committed Oct 11, 2024
1 parent dbcb5cc commit 4be5bcf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public WriteResult write(String streamId, WriteCondition writeCondition, Stream<
}
};

return RetryStrategy.retry().retryIf(__ -> writeCondition.isAnyStreamVersion()).execute(writeEvents);
return RetryStrategy.retry().retryIf(e -> e instanceof WriteConditionNotFulfilledException && writeCondition.isAnyStreamVersion()).execute(writeEvents);
}

private List<Document> convertCloudEventsToDocuments(String streamId, Stream<CloudEvent> cloudEvents, long currentStreamVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public WriteResult write(String streamId, WriteCondition writeCondition, Stream<
};

StreamVersionDiff streamVersion = RetryStrategy.retry()
.retryIf(__ -> writeCondition.isAnyStreamVersion())
.retryIf(e -> e instanceof WriteConditionNotFulfilledException && writeCondition.isAnyStreamVersion())
.execute(() -> transactionTemplate.execute(writeLogic));
return new WriteResult(streamId, streamVersion.oldStreamVersion, streamVersion.newStreamVersion);
}
Expand Down

0 comments on commit 4be5bcf

Please sign in to comment.