You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would not agree that it is not a bug, document cache is not being properly utilized :) In any case it should be a simple fix:
vardocument = Optional.ofNullable(documentCache.get(uri));
if (document.isEmpty()) {
returnloader.loadDocument(uri, options);
}
returndocument.get();
using orElseGet would require additional code to handle JsonLdError exception, but this way it is rather straightforward. If PR is still required, then this will have to wait, not enough resources on my end for it to happen this week.
Bug Report
Describe the Bug
A mixup of orElse VS orElseGet causes document to be loaded every time, even though cache is being hit.
Connector/core/common/lib/json-ld-lib/src/main/java/org/eclipse/edc/jsonld/TitaniumJsonLd.java
Lines 199 to 200 in 564d627
Expected Behavior
Cached document should not be loaded again.
Context Information
Detailed Description
If applicable, add screenshots and logs to help explain your problem.
Possible Implementation
Switching to orElseGet solves the issue. This does save extra 2-5ms per execution.
The text was updated successfully, but these errors were encountered: