Skip to content

Commit

Permalink
improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
csviri committed Aug 11, 2023
1 parent 82d5c5d commit 316c61b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ public Optional<R> distinguish(Class<R> resource, P primary, Context<P> context)
eventSourceName))
.get(resourceID);
} else {
return context.getSecondaryResourcesAsStream(resource)
.filter(resourceID::isSameResource)
.findFirst();
var eventSources = context.eventSourceRetriever().getResourceEventSourcesFor(resource);
if (eventSources.size() == 1) {
return ((Cache<R>) eventSources.get(0)).get(resourceID);
} else {
return context.getSecondaryResourcesAsStream(resource)
.filter(resourceID::isSameResource)
.findFirst();
}
}
}
}

0 comments on commit 316c61b

Please sign in to comment.