diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java index d57b2a1bfc6..6980cc10b75 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/lens/projector/ContextLoader.java @@ -666,10 +666,7 @@ private void loadLinkRefsFromFocus(LensContext context, if (!relationRegistry.isMember(linkRefVal.getRelation())) { LOGGER.trace("Inactive linkRef: will only refresh it, no processing. Relation={}, ref={}", linkRefVal.getRelation(), linkRefVal); - // We do this just to restore old behavior that ensures that linked shadows are quick-refreshed, - // deleting e.g. expired pending operations (see TestMultiResource.test429). But only if full reconciliation - // is requested. - refreshLinkedShadow(oid, context, task, result); + refreshInactiveLinkedShadow(oid, context, task, result); continue; } if (StringUtils.isBlank(oid)) { @@ -736,18 +733,27 @@ private Collection> c .build(); } - private void refreshLinkedShadow(String oid, LensContext context, Task task, OperationResult result) { + /** + * We do this just to restore old behavior that ensures that linked shadows are quick-refreshed, + * deleting e.g. expired pending operations (see TestMultiResource.test429). + */ + private void refreshInactiveLinkedShadow(String oid, LensContext context, Task task, OperationResult result) { Collection> options; if (context.isDoReconciliationForAllProjections()) { + // Ensures an attempt to complete any pending operations. + // TODO Shouldn't we include FUTURE option as well? E.g. to avoid failing on not-yet-created accounts? + // (Fortunately, we ignore any exceptions but anyway: FUTURE is used in other cases in this class.) options = schemaService.getOperationOptionsBuilder() .forceRetry() .build(); } else { - options = createStandardGetOptions(); + // This ensures only minimal processing, e.g. the quick shadow refresh is done. + options = schemaService.getOperationOptionsBuilder() + .noFetch() + .pointInTime(PointInTimeType.FUTURE) + .build(); } try { - // TODO should we even do this if no reconciliation is requested? - // We call it with noFetch and we even ignore any exceptions. provisioningService.getObject(ShadowType.class, oid, options, task, result); } catch (Exception e) { result.muteLastSubresultError();