Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static ResilienceConfiguration createResilienceConfiguration(
Try<Destination>
tryGetDestination( @Nonnull final String destinationName, @Nonnull final DestinationOptions options )
{
if( Cache.preLookupCheckEnabled && !preLookupCheckSuccessful(destinationName) ) {
if( Cache.preLookupCheckEnabled && !preLookupCheckSuccessful(destinationName, options) ) {
final String msg = "Destination %s was not found among the destinations of the current tenant.";
return Try.failure(new DestinationNotFoundException(String.format(msg, destinationName)));
}
Expand Down Expand Up @@ -388,9 +388,10 @@ private static boolean hasCauseAssignableFrom( @Nonnull final Throwable t, @Nonn
return ExceptionUtils.getThrowableList(t).stream().map(Throwable::getClass).anyMatch(cls::isAssignableFrom);
}

private boolean preLookupCheckSuccessful( final String destinationName )
private boolean preLookupCheckSuccessful( final String destinationName, final DestinationOptions options )
{
return getAllDestinationProperties()
return new ArrayList<>(
Cache.getOrComputeAllDestinations(options, this::getAllDestinationsByRetrievalStrategy).get())
Comment on lines +393 to +394
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Comment/Discussion)

I feel like with the motivation of this PR, the following would be more explicit while higher-level(?)

Suggested change
return new ArrayList<>(
Cache.getOrComputeAllDestinations(options, this::getAllDestinationsByRetrievalStrategy).get())
final DestinationServiceRetrievalStrategy retrievalStrategy =
DestinationServiceOptionsAugmenter
.getRetrievalStrategy(options)
.getOrElse(DestinationServiceRetrievalStrategy.CURRENT_TENANT);
return getAllDestinationProperties(retrievalStrategy)

.stream()
.anyMatch(properties -> properties.get(DestinationProperty.NAME).contains(destinationName));
}
Expand Down
Loading